我正在使用ant构建我的war来部署它。但是ant将war构建为文件"webapp.war"。我需要建立它作为一个文件夹"webapp。"我怎么能用蚂蚁做到呢?"
<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>
尝试复制任务(假设您正在使用Eclipse Dynamic Web Project布局):
<property name="dist" location="webapp.war"/>
<target name="war folder" depends="compile" description="generate the distribution" >
<mkdir dir="${dist}/WEB-INF/classes"/>
<copy todir="${dist}">
<fileset dir="WebContent"/>
</copy>
<copy todir="${dist}/WEB-INF/classes">
<fileset dir="yourClassDir"/>
</copy>
<!-- other stuff to copy-->
</target>