如何找到工件的URI? [英] How do I find out an artifact's URI?
本文介绍了如何找到工件的URI?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用 Aether库查找工件的URI?
How do I use the Aether library to look up an artifact's URI?
推荐答案
According to http://dev.eclipse.org/mhonarc/lists/aether-users/msg00127.html, you can do the following:
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
的位置应更改为要查找的工件.
Where artifact
should be changed to the artifact you want to look up.
这篇关于如何找到工件的URI?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文