ant 自动化编译

bulid.xml配置:

<?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>

 

其中会出现报错信息:非法字符-ufeff/等等 要进行设置与项目相同的编码格式    encoding="gbk"

你可能感兴趣的:(ant)