本文介绍了ivy:检索选择要使用的ivy.xml文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我调用ivy:retrieve
时,是否可以选择要使用哪个ivy.xml
文件?
Is there a way to select which ivy.xml
file to use when I invoke ivy:retrieve
?
在文档中查看 ,看来我可以使用settingsRef
属性选择要使用的IVY设置文件,但这不是我要修改的ivysettings.xml
文件,而是ivy.xml
.我的用例如下:
Looking at the documentation it appears that I can use the settingsRef
property to select which IVY settings file to use but it's not the ivysettings.xml
file I wish to modify, rather it's ivy.xml
. My use case is the following:
- 我有一个主要的
ivy.xml
文件,可用来获取我的编译时和运行时依赖项 - 我还具有许多构建工具链依赖项,即某些Ant任务本身使用的jars(例如findbugs,cobertura,pmd,代码样式符合性检查之类的东西).这些东西既不是我的代码的编译时也不是其运行时依赖项.而且,在我使用此工具链构建的所有项目中都是相同的,因此我希望能够在一个单独的
ivy.xml
文件中识别这些依赖关系,我可以在整个项目中简单地复制这些文件.
- I have a main
ivy.xml
file that I use to fetch my compile-time and run-time dependencies - I also have a number of build tool-chain dependencies, i.e. jars used by certain Ant tasks themselves (e.g. stuff like findbugs, cobertura, pmd, code style compliance checking etc.). That's stuff that's neither a compile time nor a run-time dependency of my code. Moreover, it's the same in all the projects I am building with this tool chain so I'd like to be able to identify these dependencies in a single, separate
ivy.xml
file that I can simply copy across my projects.
推荐答案
所以这是我最后的方法:
So this is how I did it in the end:
<target name="fetch-buildsystem-deps" depends="configure-ivy-settings">
<ivy:resolve file="ivy-buildsystem.xml"/>
<ivy:retrieve conf="build-system"
pattern="${lib-ivy-buildsystem.dir}/[artifact]-[revision](-[classifier]).[ext]"
sync="true"
type="jar, bundle"/>
</target>
…其中文件ivy-buildsystem.xml
仅标识我的Ivy任务的依赖项.例如.包含以下内容:
… where the file ivy-buildsystem.xml
identifies only the dependencies of my Ivy tasks. E.g. contains stuff like:
<configurations>
<conf name="build-system" description="artifacts needed by the build-system itself"/>
</configurations>
<dependencies>
<!--dependency org="ant-contrib" name="ant-contrib" rev="1.0b3" conf="build-system->master"/-->
<dependency org="com.puppycrawl.tools" name="checkstyle" rev="5.9" conf="build-system->default"/>
<dependency org="com.google.code.findbugs" name="findbugs-ant" rev="3.0.0" conf="build-system->default"/>
<dependency org="net.sourceforge.pmd" name="pmd-java" rev="5.5.3" conf="build-system->default"/>
</dependencies>
这篇关于ivy:检索选择要使用的ivy.xml文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!