使用ant替换WAR包里面的文件
来源:互联网 发布:王者荣耀聊天软件 编辑:程序博客网 时间:2024/05/22 08:28
一、安装ant这里就不再写了,请查看我上篇博文http://blog.csdn.net/q125488500/article/details/78579067
二、测试环境是liunx系统上
<war destfile="/home/wcs/tomcat7-wcs/webapp/wcs.war" update="true" duplicate="add" >
这里destfile指的是要替换的war,update="true" 是更新或者覆盖。
<zipfileset dir="${chgFileSrc}" includes="web.xml" fullpath="WEB-INF/web.xml" />
dir和includes设置替换文件的路径和文件名,fullpath指war包里面的路径的文件。这句话的意思是拿${chgFileSrc}里面的web.xml复制替换到war里面WEB-INF的web.xml
注意:如果替换的文件时间比war包里面被替换文件老的话是不会更新的。所以这里还用到了linux的shell修改替换文件的时间,保证比被替换文件的新。
附上build.xml
<?xml version="1.0" encoding="UTF-8"?> <project name="changerFile" basedir="." default="changerFile"> <target name="hait_cpr" description=""> <exec executable="/bin/sh"> <arg value="./digest.sh"/> </exec> </target> <target name = "changerFile" description="Updates WAR file with files from Stub folder" depends="hait_cpr" ><!-- 定义路径 --><property name="chgFileSrc" value="/home/wcs/kongywtest/src/WEB-INF" /> <property name="chgFileSrcLogin" value="/home/wcs/kongywtest/src/login" /> <war destfile="/home/wcs/tomcat7-wcs/webapp/wcs.war" update="true" duplicate="add" > <zipfileset dir="${chgFileSrc}" includes="web.xml" fullpath="WEB-INF/web.xml" /><zipfileset dir="${chgFileSrc}" includes="struts-config.xml" fullpath="WEB-INF/struts-config.xml" /><zipfileset dir="${chgFileSrc}/switch/ChannelClient" includes="channelclientBill.xml" fullpath="WEB-INF/switch/ChannelClient/channelclientBill.xml" /><zipfileset dir="${chgFileSrc}/switch/ChannelClient" includes="channelclientEsb.xml" fullpath="WEB-INF/switch/ChannelClient/channelclientEsb.xml" /><zipfileset dir="${chgFileSrc}/switch/ChannelClient" includes="channelclientEsb8703.xml" fullpath="WEB-INF/switch/ChannelClient/channelclientEsb8703.xml" /><zipfileset dir="${chgFileSrc}/switch/ChannelClient" includes="channelclientEsbEAccount.xml" fullpath="WEB-INF/switch/ChannelClient/channelclientEsbEAccount.xml" /><zipfileset dir="${chgFileSrc}/switch/ChannelClient" includes="channelclientEsbEmail.xml" fullpath="WEB-INF/switch/ChannelClient/channelclientEsbEmail.xml" /><zipfileset dir="${chgFileSrc}/switch/ChannelClient" includes="channelclientEsbIDM.xml" fullpath="WEB-INF/switch/ChannelClient/channelclientEsbIDM.xml" /><zipfileset dir="${chgFileSrc}/switch/ChannelClient" includes="channelclientEsbIndvPortal.xml" fullpath="WEB-INF/switch/ChannelClient/channelclientEsbIndvPortal.xml" /><zipfileset dir="${chgFileSrc}/switch/ChannelClient" includes="channelclientEsbSms.xml" fullpath="WEB-INF/switch/ChannelClient/channelclientEsbSms.xml" /><zipfileset dir="${chgFileSrc}/switch/ChannelClient" includes="channelclientJdh.xml" fullpath="WEB-INF/switch/ChannelClient/channelclientJdh.xml" /><zipfileset dir="${chgFileSrc}/switch/ChannelClient" includes="channelclientPortal.xml" fullpath="WEB-INF/switch/ChannelClient/channelclientPortal.xml" /><zipfileset dir="${chgFileSrc}/switch/ChannelClient" includes="channelclientXs.xml" fullpath="WEB-INF/switch/ChannelClient/channelclientXs.xml" /><zipfileset dir="${chgFileSrc}/classes/augekey" includes="auge.cer" fullpath="WEB-INF/classes/augekey/auge.cer" /><zipfileset dir="${chgFileSrc}/classes/augekey" includes="wd.keystore" fullpath="WEB-INF/classes/augekey/wd.keystore" /><zipfileset dir="${chgFileSrc}/classes/conf" includes="eap-ssapi.conf" fullpath="WEB-INF/classes/conf/eap-ssapi.conf" /><zipfileset dir="${chgFileSrc}/classes/eaccount" includes="eaccount.properties" fullpath="WEB-INF/classes/eaccount/eaccount.properties" /><zipfileset dir="${chgFileSrc}/classes/wd" includes="wd.properties" fullpath="WEB-INF/classes/wd/wd.properties" /><zipfileset dir="${chgFileSrc}/classes" includes="commonResources.properties" fullpath="WEB-INF/classes/commonResources.properties" /><zipfileset dir="${chgFileSrcLogin}" includes="login.jsp" fullpath="login/login.jsp" /></war></target></project>
附上digest.sh
echo "eaccount.properties update time" touch -d 23:59 /home/wcs/kongywtest/src/WEB-INF/classes/eaccount/eaccount.propertiestouch -d 23:59 /home/wcs/kongywtest/src/WEB-INF/classes/augekey/auge.certouch -d 23:59 /home/wcs/kongywtest/src/WEB-INF/classes/augekey/wd.keystoretouch -d 23:59 /home/wcs/kongywtest/src/WEB-INF/classes/augekey/eap-ssapi.conftouch -d 23:59 /home/wcs/kongywtest/src/WEB-INF/classes/augekey/eap-ssapi.conftouch -d 23:59 /home/wcs/kongywtest/src/WEB-INF/classes/wd/wd.propertiestouch -d 23:59 /home/wcs/kongywtest/src/WEB-INF/classes/commonResources.propertiestouch -d 23:50 /home/wcs/kongywtest/src/WEB-INF/switch/ChannelClient/*touch -d 23:59 /home/wcs/kongywtest/src/WEB-INF/struts-config.xmltouch -d 23:59 /home/wcs/kongywtest/src/WEB-INF/web.xmltouch -d 23:59 /home/wcs/kongywtest/src/login/login.jspecho "web.xml update time"
阅读全文
0 0
- 使用ant替换WAR包里面的文件
- 使用ant修改war包
- 替换war包中的文件
- Eclipse包文件里面的全部替换
- 使用maven打war包 对文件进行替换操作
- ANT打war包时出现重复文件的解决方法
- 使用ant发布war包build.xml的配置.
- 使用ant发布war包build.xml的配置
- ant使用及制作war包
- 使用ant生成war包(1)
- 使用ant生成war包(2)
- 使用ant生成war包(3)
- web工程使用ant打war包
- 使用ant脚本生成war包
- ant使用(二)生成war包
- war包里替换CLASS文件
- Ant打war包的小例子
- Ant 打War包
- 数据安全加密技术分析
- oracle中sql语句查询优化(三)
- 阿里云短信验证服务整套demo教程
- 产品经理基本技能业务交流
- bzoj1036 树的统计Count 树链剖分
- 使用ant替换WAR包里面的文件
- Replugin host gradle插件分析
- 深度学习的实践方面Quiz 2
- trca工具的安装及使用
- eMMC的MMC模式与SPI模式
- Activity如何向Fragment中传递数据
- JQuery控制屏幕滚动到指定控件位置
- lua支持的最大整数
- ElasticSearch搜索提示(Suggester)