在ant中获取maven运行时依赖项
我想从ant中的maven获取运行时依赖项集。我正在使用maven ant任务 我知道您可以通过作用域()限制依赖关系: 但是,我只想获取运行时依赖项(即排除编译依赖项)。到目前为止,我最好的想法是获取运行时依赖项和编译依赖项,并遍历运行时依赖项以找到那些不在编译依赖项中的依赖项,但我还没有找到如何做到这一点在ant中获取maven运行时依赖项,ant,maven,dependencies,Ant,Maven,Dependencies,我想从ant中的maven获取运行时依赖项集。我正在使用maven ant任务 我知道您可以通过作用域()限制依赖关系: 但是,我只想获取运行时依赖项(即排除编译依赖项)。到目前为止,我最好的想法是获取运行时依赖项和编译依赖项,并遍历运行时依赖项以找到那些不在编译依赖项中的依赖项,但我还没有找到如何做到这一点 有什么想法吗?你需要的东西大致如下: ... <artifact:pom id="maven.project" file="pom.xml"/> <artifact:d
有什么想法吗?你需要的东西大致如下:
...
<artifact:pom id="maven.project" file="pom.xml"/>
<artifact:dependencies useScope="runtime"
filesetId="dependencies.runtime"
pomRefId="maven.project"
settingsFile="${settings.xml}"/>
...
。。。
...
然后可以像往常一样使用dependencies.runtime文件集
我希望这更有意义。因此,我试图找出运行时文件集和编译文件集的区别(尽管这假设编译文件集中没有任何东西不在运行时文件集中)
但是,这并没有产生我预期的结果,所以我做了以下工作,发现运行时文件集不包含编译依赖项
<echo message="${toString:runtime}" />
<echo message="${toString:compile}" />
因此,我可以只使用运行时范围…每个文件集将只包含各自范围的依赖项。运行时依赖项将不包含编译时依赖项。嘿!我建议你提交一份bug报告,要求他们修复文档。否则,这就是你需要的。如果你觉得我的答案有用且正确,你可以接受。干杯!:)错误报告已提交给maven ant tasks JIRA
...
<artifact:pom id="maven.project" file="pom.xml"/>
<artifact:dependencies useScope="runtime"
filesetId="dependencies.runtime"
pomRefId="maven.project"
settingsFile="${settings.xml}"/>
...
<artifact:dependencies filesetId="runtime" scopes="runtime">
<artifact:pom file="pom.xml" id="myProject" />
</artifact:dependencies>
<artifact:dependencies filesetId="compile" scopes="compile">
<artifact:pom file="pom.xml" id="myProject" />
</artifact:dependencies>
<difference id="difference" >
<resources refid="runtime" />
<resources refid="compile" />
</difference>
<echo message="${toString:runtime}" />
<echo message="${toString:compile}" />