Using Ant To Build War As a Folder
I am using ant to build my war to deploy it. But ant builds the war as a file "webapp.war". I need to build it as a folder "webapp.war" how can I do it using ant?
<target name="war" depends="compile">开发者_StackOverflow
<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>
try this...works for me
<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>
try copy task (assume you are using Eclipse Dynamic Web Project layout):
<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>
精彩评论