我正在使用AntwithIvy所以我的compile任务看起来像:
<target name="compile" depends="prepare, retrieve" ..
该retrieve任务用于解析和获取Ivy依赖项。因此,由于我的compile任务取决于任务,因此每次编译都会触发依赖关系retrieve的解析。Ivy同上,run因为run任务取决于compile.
这会浪费时间,所以我想要一个dry-compile不依赖于Ivy任务的。
用例是,如果没有Ivy依赖项发生变化,我将能够执行 anant dry-compile甚至 anant dry-run而不触发Ivy解析功能。
有没有办法在Ant不复制粘贴目标的情况下创建具有不同depends属性的变体?
我的ivy.xml文件是:
<ivy-module version="2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
<info organisation="foo" module="bar" status="integration"/>
<dependencies>
<dependency org="org.apache.commons" name="commons-lang3" rev="3.1"/>
</dependencies>
</ivy-module>
Antresolve目标(目标compile取决于)是:
<target name="test-ivy" description="Test ivy installation">
<ivy:settings />
</target>
<target name="resolve" depends="test-ivy">
<ivy:resolve/>
<ivy:retrieve sync="true" pattern="${ivylibs.dir}/[artifact]-[revision](-[classifier]).[ext]"/>
</target>