如何在maven中获取依赖项的文件句柄

时间:2010-11-16 19:09:12

标签: maven maven-plugin

有没有人知道在POM中声明依赖项的文件句柄的最佳方法?我意识到有一个依赖插件,但我们试图避免将工件复制到本地目录的成本(文件很大)。

1 个答案:

答案 0 :(得分:0)

所以伪代码如下所示:

Artifact artifact = ArtifactFactory.createArtifact("group", "artifact", "version1");

// The local Repo and remote repo can be injected into your mojo using annoations.
AtifactResolver resolver = new AtifactResolver(localRepo, remoteRepoList);

resolver.resolve(artificat);

File file = artifact.getFile();