Ant 更新war包

xiaoxiao2021-02-28  130

Ant 更新war包

服务器分 IT、ST、UT、PT环境,各个环境对应的配置文件不同,通常打完包要手动去更新这些配置文件。

为提高效率,节省打包时间研究了一下“war”这个task,发现是可以更新打包的包,参数如下

update 参数官方介绍:

parameterDescriptionRequiredupdateindicates whether to update or overwrite the destination file if it already exists. Default is “false”.No

使用方法

<target name="各个环境" depends="package"> <war destfile="war包" update="true"> <zipfileset dir="替换文件位置" includes="*.xml" prefix="war包内文件位置"/> </war> </target> <target name="package-it" depends="package"> <war destfile="${war.home}/${app.code}-${app.version}-${version.date}.war" update="true"> <zipfileset dir="${war.home}/it" includes="*.xml" prefix="WEB-INF/config/"/> </war> </target>

ant输出如下

package: [war] Building war: D:\Program Files\eclipse\workspace\updatetest\war\updatetest-1.0.0-20170901143924.war package-it: [war] Updating war: D:\Program Files\eclipse\workspace\updatetest\war\updatetest-1.0.0-20170901143924.war BUILD SUCCESSFUL Total time: 53 seconds

注意: update 的文件要比war包里的时间新,否则不会更新相应的文件。

转载请注明原文地址: https://www.6miu.com/read-81881.html

最新回复(0)