由于通過tomcat的manager無法完全清除msms目錄,導致重新deploy會無效,于是想出了怪招:
<target name="deploy-local" description="Install application in Local Tomcat">
<echo message="deploying to local ..." />
<exec executable="cmd" os="Windows 2000" vmlauncher="false">
<arg line="/c start ${tomcat.dir}/bin/shutdown.bat" />
</exec>
<delete dir="${tomcat.webapps}/${context-path}" />
<copy todir="${tomcat.webapps}" overwrite="true">
<fileset dir="${dist}">
<include name="${context-path}.war" />
</fileset>
</copy>
<exec
executable="${tomcat.dir}/bin/startup.bat" os="Windows 2000"
spawn="true" vmlauncher="false">
<arg line="/c start ${tomcat.dir}/bin/startup.bat" />
</exec>
</target>
首先通過調用shutdown.bat,而且不設置spawn="true",這樣就會有一個cmd窗口在那里留著,可以看著tomcat停掉了,然后關
閉這個cmd窗口,ant才會繼續向下執行刪除和拷貝,然后自動啟動tomcat。雖然看上去比較怪,好歹還算管用,哈哈。