Ant Automated Compilation

Source: Internet
Author: User

Bulid.xml configuration:

<?xml version= "1.0" encoding= "UTF-8"?>
<project name= "MSS" default= "clean" basedir= "." >

<property name= "Dest.dir" value= "web-inf/classes"/>
<property name= "Src.dir" value= "src"/>
<property name= "Src.resource" value= "Src/resource"/>
<property name= "Webroot.dir" value= "Webroot"/>
<property name= "Webinf.dir" value= "Web-inf"/>
<property name= "Tomcat.dir" value= "/opt/kds/mobile-stock/3rd-soft/tomcat-7.0.59/tomcat7/lib"/>

<target name= "Init" >
<delete dir= "${dest.dir}"/>
<mkdir dir= "${dest.dir}"/>
</target>

<target name= "Compile" depends= "init" >
<javac srcdir= "${src.dir}" destdir= "${dest.dir}" Includeantruntime= "false" encoding= "GBK" >
<classpath>
<fileset dir= "Webroot/web-inf/lib" >
<include name= "*.jar"/>
</fileset>
<fileset dir= "${tomcat.dir}" >
<include name= "Jsp-api.jar"/>
<include name= "Servlet-api.jar"/>
</fileset>
</classpath>
</javac>
</target>

<target name= "CopyFile" depends= "compile" >
<copy todir= "${webinf.dir}" >
<fileset dir= "${webroot.dir}/web-inf" >
<include name= "* *"/>
<!--include name= "Lib/*.*"/>
<include name= "* *"/>-->
<exclude name= "*.svn"/>
</fileset>
</copy>

<copy todir= "." >
<fileset dir= "${webroot.dir}" >
<include name= "*.jsp"/>
<include name= "*.html"/>
<exclude name= "*.svn"/>
<include name= "resource/**"/>
</fileset>
</copy>

<copy todir= "${dest.dir}" >
<fileset dir= "${src.dir}" >

<include name= "*.xml"/>
<include name= "*.properties"/>
<exclude name= "*.svn"/>
</fileset>
</copy>

</target>

<target name= "clean" depends= "CopyFile" >
<delete dir= "${webroot.dir}"/>
<delete dir= "${src.dir}"/>
</target>

</project>

There will be an error message: illegal character-ufeff/and so on to set the same encoding format as the project encoding= "GBK"

Ant Automated Compilation

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.