Ant build Web project Build script

Source: Internet
Author: User
Tags create directory echo message

Build.xml

<?xml version= "1.0" encoding= "UTF-8" standalone= "no"? ><project name= "edu_2.0" basedir= "." default= "war" > <!--introducing configuration information--><property file= "build.properties"/><!--Java source code directory--><property name= "Src.dir" location= "${BASEDIR}/SRC"/><!--build directory--><property name= "Build.dir" location= "${basedir}/build"/> <!--class file directory--><property name= "build.classes" location= "${build.dir}/classes"/><!--Packaging Directory-- <property name= "Build.war" location= "${build.dir}/war"/><!--the name of the Web app and the name of the war after packaging--><property name= "Web.name" value= "edu_2.0"/><!--Web root--><property name= "Web.root" value= "WebRoot"/> <property N Ame= "web. Web-inf "location=" ${web.root}/web-inf "/><property name=" Web.lib "location=" ${web. Web-inf}/lib "/><!--define compile-time classpath-<path id=" Compile.path "> <!--copy third-party jar package--<f   Ileset dir= "${web.lib}" includes= "*.lib" > <include name= "*.jar"/>     </fileset> <!--copy of the jar package under Tomcat--<fileset dir= "${tomcat_home}/lib" > <include name= "**/* . Jar "/> </fileset> </path><!--Create directory--<target name=" init "description=" Initialize "depends=" CLE        An "> <!--mkdir Create directory--<mkdir dir=" ${build.dir} "/> <mkdir dir=" ${build.classes} "/> <mkdir dir= "${build.war}"/> <echo> initialization work is over!        </echo> </target><!--Web Project Compilation--<target name= "compile" depends= "init" description= "compile" > <javac destdir= "${build.classes}" srcdir= "src" includeantruntime= "false" fork= "true" Bootclasspath= "${java_home} /jre/lib/rt.jar "encoding=" UTF-8 "> <compilerarg line="-encoding UTF-8 "/> <classpath refid=" Compile.path "/> </javac> <!--Copy the configuration file in Source--<copy todir=" ${build.classes} "><fileset di R= "${src.dir}" ><exclude name= "**/*.java"/></fileset> </Copy> <echo message= "compilation Complete!        "/> </target><!--Web project into war package--<target name=" war "depends=" Compile "description=" Package War file ">            <war destfile= "${build.war}/${web.name}.war" > <fileset dir= "${web.root}" includes= "**/*.*"/> <lib dir= "${web.lib}"/> <webinf dir= "${web. Web-inf} "/> <classes dir=" ${build.classes} "/> </war> <echo> package complete! </echo> </target><!--Creating Directories--<target name= "clean" description= "cleanup" > <delete dir= "$ {build.classes} "/> <delete dir=" ${build.war} "/> <echo> cleanup complete! </echo> </target></project>

Build.properties

Tomcat_home = d:\\programfiles\\apache-tomcat-7.0.  $  = D:\\programfiles\\jdk1. 7. 0_25

Project structure

Ant build Web project Build script

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.