@Override protected void finalize() throws Throwable { stages = null; path.reset(); } }
@Override protected ClassLoader getClassLoader() { return cl.get(); }
@Override public RepositorySystemSession getRepoSession() { return session.get(); }
String runtime[] = X_Properties.platform.get().split(","); JavaInjector.registerSingletonProvider(iface, injectionTargets.get(iface).getName()); JavaInjector.registerInstanceProvider(iface, injectionTargets.get(iface).getName());
protected int maxThreads() { return maxThreads.get(); }
@Override public String localRepo() { return session.get().getLocalRepository().getBasedir().getAbsolutePath(); }
protected RepositorySystemSession initLocalRepo() { DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession(); String userHome = System.getProperty("user.home"); String path = "target/local-repo"; if (userHome != null) { File maybeUse = new File(userHome, ".m2/repository"); if (maybeUse.exists()) { path = maybeUse.getAbsolutePath(); } } LocalRepository localRepo = new LocalRepository(path); localRepo.getBasedir().mkdirs(); session.setLocalRepositoryManager(repoSystem.get() .newLocalRepositoryManager(session, localRepo)); return session; }
@Override public LocalArtifactResult loadLocalArtifact(String groupId, String artifactId, String classifier, String extension, String version) { Moment before = X_Time.now(); RepositorySystemSession session = this.session.get(); DefaultArtifact artifact = new DefaultArtifact( groupId,artifactId,classifier, X_String.isEmpty(extension) ? "jar" : extension, version); try { LocalArtifactRequest request = new LocalArtifactRequest(artifact, null, null); return session.getLocalRepositoryManager().find(session, request); } finally { if (X_Log.loggable(LogLevel.DEBUG)) { X_Log.debug("Resolved: " + artifact.toString() + " in " + X_Time.difference(before)); } } }
@Override public ArtifactResult loadArtifact(String groupId, String artifactId, String classifier, String extension, String version) { Moment before = X_Time.now(); RepositorySystem repoSystem = this.repoSystem.get(); RepositorySystemSession session = this.session.get(); DefaultArtifact artifact = new DefaultArtifact( groupId,artifactId,classifier, X_String.isEmpty(extension) ? "jar" : extension, version); try { ArtifactRequest request = new ArtifactRequest(artifact, remoteRepos(), null); return repoSystem.resolveArtifact(session, request); } catch (ArtifactResolutionException e) { X_Log.log(getClass(), getLogLevel(), "Resolved? ", e.getResult().isResolved(), e.getResult().getExceptions()); X_Log.log(getClass(), getLogLevel(), "Could not download " + artifact, e); throw X_Debug.rethrow(e); } finally { if (X_Log.loggable(LogLevel.DEBUG)) { X_Log.debug("Resolved: " + artifact.toString() + " in " + X_Time.difference(before)); } } }