使用ant替換WAR包裡面的檔案

2021-08-11 05:15:35 字數 1403 閱讀 8018

一、安裝ant這裡就不再寫了,請檢視我上篇博文

二、測試環境是liunx系統上

這裡destfile指的是要替換的war,update="true" 是更新或者覆蓋。

dir和includes設定替換檔案的路徑和檔名,fullpath指war包裡面的路徑的檔案。這句話的意思是拿$裡面的web.xml複製替換到war裡面web-inf的web.xml

注意:如果替換的檔案時間比war包裡面被替換檔案老的話是不會更新的。所以這裡還用到了linux的shell修改替換檔案的時間,保證比被替換檔案的新。

附上build.xml

<?xml version="1.0" encoding="utf-8"?>   	

附上digest.sh

echo "eaccount.properties update time"  

touch -d 23:59 /home/wcs/kongywtest/src/web-inf/classes/eaccount/eaccount.properties

touch -d 23:59 /home/wcs/kongywtest/src/web-inf/classes/augekey/auge.cer

touch -d 23:59 /home/wcs/kongywtest/src/web-inf/classes/augekey/wd.keystore

touch -d 23:59 /home/wcs/kongywtest/src/web-inf/classes/augekey/eap-ssapi.conf

touch -d 23:59 /home/wcs/kongywtest/src/web-inf/classes/augekey/eap-ssapi.conf

touch -d 23:59 /home/wcs/kongywtest/src/web-inf/classes/wd/wd.properties

touch -d 23:59 /home/wcs/kongywtest/src/web-inf/classes/commonresources.properties

touch -d 23:50 /home/wcs/kongywtest/src/web-inf/switch/channelclient/*

touch -d 23:59 /home/wcs/kongywtest/src/web-inf/struts-config.xml

touch -d 23:59 /home/wcs/kongywtest/src/web-inf/web.xml

touch -d 23:59 /home/wcs/kongywtest/src/login/login.jsp

echo "web.xml update time"

tomcat裡面的war包解壓後沒有訪問許可權

ubuntu tomcat8 無許可權進入tomcat的war包解壓後的子目錄 由於可能 中對tomcat目錄寫入日誌 臨時目錄等需要讀寫許可權,而造成io異常。設定整個tomcat目錄的擁有者為你的使用者名稱,可以對tomcat下任何子資料夾進行讀寫操作。注意 以下命令將tomcat路徑替換為自己...

替換jar包裡面的檔案。利用jar ucf

專案打補丁,需要修改jar包裡面的某個檔案。利用壓縮工具替換,不能執行。報錯顯示 不能執行被壓縮過的檔案。jar uvf0 ztev card service 1.0.jar static enterprisecard.html命令解釋 ztev card service 1.0.jar 將要替換的...

Tomcat下使用war包發布專案

2.修改 conf server.xml檔案.在host節點下增加如下參考 reloadable true 也許有些人還不懂war包是什麼,其實就是你的專案下的webroot資料夾中的內容 不加webroot這個資料夾 打成乙個壓縮包,字尾用war,其實和rar差不多,不過tomcat就認war。那...