About MyEclipse automatic generation of the Ant build.xml configuration file, the method of generation is very hidden, it is accidentally found.
Select the project you want to generate the Build.xml file in, right-click. Export-> General, Ant Buildfiles.
Click Next, and then click Finish.
OK, the build is complete. Then you can modify it according to your needs.
Then add the node to generate the war
[HTML]View PlainCopy
- <target name="war" depends="Build-project">
- <mkdir dir="build/classes"/>
- <mkdir dir="dist"/>
- <war destfile= "dist/xd.war" webxml="Webroot/web-inf/web.xml">
- <fileset dir="WebRoot"/>
- <Lib dir="webroot/web-inf/lib"/>
- <classes dir="build/classes"/>
- </War>
- </target>
Attach the build script:
[HTML]View PlainCopy
- <? XML version="1.0" ?>
- <project name= "AntExample1" default="war">
- <path id="Compile.classpath">
- <fileset dir="Webcontent/web-inf/lib">
- <include name="*.jar"/>
- </fileset>
- </path>
- <target name="init">
- <mkdir dir="build/classes"/>
- <mkdir dir="dist" />
- </target>
- <target name="Compile" depends="init" >
- <javac destdir="build/classes" debug="true" srcdir="src">
- <classpath refid="Compile.classpath"/>
- </javac>
- </target>
- <target name="war" depends="compile">
- <war destfile= "dist/antexample.war" webxml="Webcontent/web-inf/web.xml">
- <fileset dir="webcontent"/>
- <Lib dir="webcontent/web-inf/lib"/>
- <classes dir="build/classes"/>
- </War>
- </target>
- <target name="clean">
- <delete dir="dist" />
- <delete dir="Build" />
- </target>
- </Project>
MyEclipse automatic generation of ant BUILD.XM