如何在maven中获取依赖项的文件句柄
有人知道获得POM中声明的依赖项的文件句柄的最佳方法吗?我意识到有一个依赖插件,但我们正试图避免将工件复制到本地目录(文件很大)的成本 因此psuedo代码如下所示:如何在maven中获取依赖项的文件句柄,maven,maven-plugin,Maven,Maven Plugin,有人知道获得POM中声明的依赖项的文件句柄的最佳方法吗?我意识到有一个依赖插件,但我们正试图避免将工件复制到本地目录(文件很大)的成本 因此psuedo代码如下所示: Artifact artifact = ArtifactFactory.createArtifact("group", "artifact", "version1"); // The local Repo and remote repo can be injected into your mojo using annoation
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();
我发现了一种结合使用ArtifactFactory和ArtifactResolver类的方法。