【问题标题】:Build multiple environments with a single target and single command(Anding -D and property file)使用单个目标和单个命令构建多个环境(Anding -D 和属性文件)
【发布时间】:2012-12-25 23:49:12
【问题描述】:

我必须创建一个命令来创建多个(dev|qa|uat)war/ear。 类似的东西:

ant -f build.xml -Denv=dev|qa|uat -propertyfile= devProp|qaProp|uatProp 
  -Dstage.dir=devdir|qadir|uatdir

我已经为每个环境有不同的属性文件、不同的暂存、部署目标。我也有不同的 .cmd 文件来分别构建它们。

我遇到的问题是:如何一次性构建它们?

【问题讨论】:

  • 你不能使用 3 个任务和 3 个不同的道具集吗?然后根据 3 个中的每一个执行单个任务(以构建所有内容)

标签: ant build-process build-automation


【解决方案1】:

您可以在目标中使用<subant /> 指令。

写下一个新的ant脚本(即master.xml),假设你的原始构建在脚本build.xml中,你可以有类似的东西:

<target name="build-all">
   <subant target="build-prod">
     <fileset dir="." includes="build.xml"/>
     <propertyset ......../> <!-- properties for the prod build -->
   </subant>
   <subant target="build-dev">
     <fileset dir="." includes="build.xml"/>
     <propertyset ......../> <!-- properties for the dev build -->
   </subant>
</target>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-12-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-07
    • 2019-01-26
    • 2022-06-10
    • 2017-10-11
    相关资源
    最近更新 更多