如何使用Aether library查找工件的URI?
答案 0 :(得分:0)
根据http://dev.eclipse.org/mhonarc/lists/aether-users/msg00127.html,您可以执行以下操作:
Artifact artifact = new DefaultArtifact("com.google.guava", "guava", "jar", "18.0");
MavenDefaultLayout defaultLayout = new MavenDefaultLayout();
RemoteRepository centralRepository = new RemoteRepository.Builder("central", "default", "http://repo1.maven.org/maven2/").build();
URI centralUri = URI.create(centralRepository.getUrl());
URI artifactUri = centralUri.resolve(defaultLayout.getPath(artifact));
应将artifact
更改为您要查找的工件。
答案 1 :(得分:0)
只是为了完成正确的答案。 你可以像这样创建一个神器
Artifact artifact = new DefaultArtifact("com.google.guava", "guava", "jar", "18.0");