我正在使用 ant 构建我的 war 来部署它。但是 Ant 将 war 构建为文件“webapp.war”。我需要将它构建为文件夹“webapp.war”,我如何使用 ant 来完成它?
<target name="war" depends="compile">
<war destfile="dist/AntExample.war"
webxml="WebContent/WEB-INF/web.xml" keepcompression="false">
<fileset dir="WebContent"/>
<lib dir="WebContent/WEB-INF/lib"/>
<classes dir="build/classes"/>
</war>
</target>
最佳答案
试试这个...对我有用
<target name="war" depends="compile">
<war destfile="dist/deployme_temp.war" webxml="web/WEB-INF/web.xml">
<fileset dir="web"/>
<lib dir="web/WEB-INF/lib"/>
<classes dir="build/classes"/>
</war>
</target>
<target name="unzip" depends="war">
<unzip src="dist/deployme_temp.war" dest="dist/deployme.war" />
</target>
<target name="copy-war" depends="unzip">
<copy todir="${deploy.destination}/deployme.war" overwrite="true">
<fileset dir="dist/deployme.war"/>
</copy>
</target>
关于java - 使用 Ant 将 War 构建为文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7185098/