我有一个项目,为不同的构建变体设置了3个目标,每个目标都有自己的属性文件,定义如下:
<target name="dev">
<property file="dev.properties" />
<antcall target="build" />
</target>
<target name="test">
<property file="test.properties" />
<antcall target="build" />
</target>
<target name="prod">
<property file="prod.properties" />
<antcall target="build" />
</target>所有属性文件都定义相同的属性。现在我需要制定一个目标来构建它们,我尝试了这样的方法:
<target name="all">
<antcall target="dev" />
<antcall target="test" />
<antcall target="prod" />
</target>但问题是,ant属性是不可变的,我最终得到了dev.properties为所有构建提供的属性。如果我想用自己的属性构建所有三个目标,那么推荐的方法是什么?
发布于 2015-03-14 12:37:13
如果有一个构建脚本,然后在运行时决定它的用途,岂不是简单得多吗?
例如:
ant -propertyfile build-dev.properties
ant -propertyfile build-test.properties
ant -propertyfile build-prod.properties
..当使用像Jenkins这样的工具自动化构建时,这种方法更灵活。它可以检测源代码更改,并自动(并并行)运行每个构建类型(如果这是期望的结果)。
https://stackoverflow.com/questions/29047677
复制相似问题