use of org.eclipse.aether.artifact.DefaultArtifact in project gate-core by GateNLP.
the class SimpleMavenCache method main.
public static void main(String[] args) throws Exception {
for (RemoteRepository repo : Utils.getRepositoryList()) {
System.out.println(repo);
}
Artifact artifactObj = new DefaultArtifact("uk.ac.gate.plugins", "annie", "jar", "8.5-SNAPSHOT");
// artifactObj = artifactObj.setFile(
// new File("/home/mark/.m2/repository/uk/ac/gate/plugins/annie/8.5-SNAPSHOT/annie-8.5-SNAPSHOT.jar"));
SimpleMavenCache reader = new SimpleMavenCache(new File("repo"));
System.out.println(reader.findArtifact(artifactObj));
System.out.println(reader.findVersions(artifactObj));
reader.cacheArtifact(artifactObj);
System.out.println(reader.findArtifact(artifactObj));
System.out.println(reader.findVersions(artifactObj));
reader = new SimpleMavenCache(new File("repo2"), new File("repo"));
System.out.println(reader.findArtifact(artifactObj));
System.out.println(reader.findVersions(artifactObj));
}
use of org.eclipse.aether.artifact.DefaultArtifact in project gate-core by GateNLP.
the class SimpleMavenCache method cacheParents.
private void cacheParents(File pom, RepositorySystem repoSystem, RepositorySystemSession repoSession, List<RemoteRepository> repos) throws ModelBuildingException, IOException, ArtifactResolutionException {
ModelBuildingRequest req = new DefaultModelBuildingRequest();
req.setProcessPlugins(false);
req.setPomFile(pom);
req.setModelResolver(new SimpleModelResolver(repoSystem, repoSession, repos));
req.setValidationLevel(ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL);
ModelBuilder modelBuilder = new DefaultModelBuilderFactory().newInstance();
Model model = modelBuilder.build(req).getEffectiveModel();
Parent parent = model.getParent();
if (parent == null)
return;
Artifact pomArtifact = new DefaultArtifact(parent.getGroupId(), parent.getArtifactId(), "pom", parent.getVersion());
ArtifactRequest artifactRequest = new ArtifactRequest(pomArtifact, repos, null);
ArtifactResult artifactResult = repoSystem.resolveArtifact(repoSession, artifactRequest);
// but copy it to a file named for the original requested version number
File file = getArtifactFile(artifactRequest.getArtifact());
FileUtils.copyFile(artifactResult.getArtifact().getFile(), file);
cacheParents(artifactResult.getArtifact().getFile(), repoSystem, repoSession, repos);
}
use of org.eclipse.aether.artifact.DefaultArtifact in project launcher by runelite.
the class Launcher method main.
public static void main(String[] args) throws Exception {
OptionParser parser = new OptionParser();
parser.accepts("version").withRequiredArg();
parser.accepts("clientargs").withRequiredArg();
parser.accepts("nojvm");
parser.accepts("debug");
OptionSet options = parser.parse(args);
try {
UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
} catch (Exception ex) {
logger.warn("Unable to set cross platform look and feel", ex);
}
LauncherFrame frame = new LauncherFrame();
Bootstrap bootstrap = getBootstrap();
// update packr vmargs
PackrConfig.updateLauncherArgs(bootstrap);
if (options.has("version")) {
String version = (String) options.valueOf("version");
logger.info("Using version {}", version);
DefaultArtifact artifact = bootstrap.getClient();
artifact = (DefaultArtifact) artifact.setVersion(version);
bootstrap.setClient(artifact);
// non-releases are not signed
verify = false;
}
ArtifactResolver resolver = new ArtifactResolver(REPO_DIR);
resolver.setListener(frame);
resolver.addRepositories();
Artifact a = bootstrap.getClient();
List<ArtifactResult> results = resolver.resolveArtifacts(a);
if (results.isEmpty()) {
logger.error("Unable to resolve artifacts");
return;
}
try {
verifyJarSignature(results.get(0).getArtifact().getFile());
logger.info("Verified signature of {}", results.get(0).getArtifact());
} catch (CertificateException | IOException | SecurityException ex) {
if (verify) {
logger.error("Unable to verify signature of jar file", ex);
return;
} else {
logger.warn("Unable to verify signature of jar file", ex);
}
}
frame.setVisible(false);
frame.dispose();
String clientArgs = getArgs(options);
// packr doesn't let us specify command line arguments
if ("true".equals(System.getProperty("runelite.launcher.nojvm")) || options.has("nojvm")) {
ReflectionLauncher.launch(results, clientArgs, options);
} else {
JvmLauncher.launch(bootstrap, results, clientArgs, options);
}
}
use of org.eclipse.aether.artifact.DefaultArtifact in project launcher by runelite.
the class ArtifactResolverTest method printJson.
@Test
public void printJson() {
Bootstrap b = new Bootstrap();
Gson g = new Gson();
DefaultArtifact a = new DefaultArtifact("net.runelite", "client", "", "jar", "1.0.0-SNAPSHOT");
b.setClient(a);
b.setClientJvmArguments(new String[] { "-Xmx256m", "-Xss2m", "-Dsun.java2d.noddraw=true", "-XX:CompileThreshold=1500", "-Xincgc", "-XX:+UseConcMarkSweepGC", "-XX:+UseParNewGC" });
System.out.println(g.toJson(b));
}
use of org.eclipse.aether.artifact.DefaultArtifact in project launcher by runelite.
the class ArtifactResolverTest method test.
@Test
@Ignore
public void test() throws Exception {
ArtifactResolver resolver = new ArtifactResolver(folder.newFolder());
resolver.addRepositories();
Artifact a = new DefaultArtifact("net.runelite", "client", "", "jar", "1.0.0-SNAPSHOT");
List<ArtifactResult> artifacts = resolver.resolveArtifacts(a);
for (ArtifactResult a2 : artifacts) System.out.println(a2.getArtifact().getFile());
}
Aggregations