4
我正在编写一个Maven 2插件,它必须遍历所有项目依赖关系并递归遍历这些依赖关系的所有依赖关系。到现在为止我只设法与此代码来解决直接依赖:如何递归解决Maven 2插件中的依赖关系
for (Dependency dependency : this.project.getModel().getDependencies())
{
Artifact artifact = this.artifactFactory.createArtifact(
dependency.getGroupId(),
dependency.getArtifactId(),
dependency.getVersion(),
dependency.getScope(),
dependency.getType());
this.artifactResolver.resolve(
artifact,
this.remoteRepositories,
this.localRepository);
....
}
我如何可以做同样的递归于是我也找到依赖的依赖等等?
A)我已经尝试getArtifacts(),但它总是返回一个空集。所以我只是错过了这个注释。非常好,谢谢! B)目前我必须支持Maven 2.这将很快有望改变。 – kayahr 2011-02-25 13:17:54
亲爱的不知名的downvoter,或许你想指定你不喜欢这个答案? – 2012-02-20 11:59:28
+1这是最后的触摸http://stackoverflow.com/questions/11341783/accessing-classes-in-custom-maven-reporting-plugin – MikePatel 2012-07-06 10:32:25