ant build.xml示例


<?xml version="1.0" encoding="utf-8" ?>
<project default="all" basedir=".">
<property environment="env" />
<property name="appname" value="virt" />
<property name="jarname" value="yoyo-virt" />
<property name="mainclass" value="com.yoyosys.virt.navigation.service.SystemResourceMonitor" />
<property name="src" value="src" />
<property name="conf" value="conf" />
<property name="build" value="${basedir}/build" />
<property name="build.src" value="${build}/src" />
<property name="build.class" value="${build}/class" />
<property name="build.doc" value="${build}/doc" />

<property name="debug" value="off" />
<property name="optimize" value="on" />
<property name="deprecation" value="on" />
<property name="packages" value="com.yoyosys.virt.*" />

<path id="classpath">
<fileset dir="./WebContent/WEB-INF/lib">
<include name="*.jar" />
</fileset>
<fileset dir="./lib">
<include name="*.jar" />
</fileset>
</path>

<target name="all" depends="init,build,jar" description="make all task." />

<target name="init" depends="clean">
<mkdir dir="${build}" />
<mkdir dir="${build.src}" />
<mkdir dir="${build.class}" />
<mkdir dir="${build.doc}" />
<copy todir="${build.src}">
<fileset dir="${src}" />
<fileset dir="${conf}" />
</copy>
</target>

<target name="build" depends="init">
<javac srcdir="${build.src}" destdir="${build.class}" encoding="UTF-8" debug="${debug}" optimize="${optimize}" deprecation="${deprecation}" includeantruntime="on">
<include name="com/**/*.java" />
<classpath refid="classpath" />
</javac>
<copy todir="${build.class}">
<fileset dir="${build.src}">
<include name="handlers/*" />
<include name="rdb/*" />
</fileset>
</copy>
</target>

<target name="javadoc" depends="init">
<javadoc packagenames="${packages}" sourcepath="${build.src}" destdir="${build.doc}" author="true" version="true" use="true" splitindex="true" windowtitle="${appname} API" doctitle="${appname}" charset="UTF-8" encoding="UTF-8" docencoding="UTF-8">
<classpath refid="classpath" />
</javadoc>
</target>

<target name="jar" depends="build">
<pathconvert property="libs.project" pathsep=" ">
<mapper>
<chainedmapper>
<!-- remove absolute path -->
<flattenmapper />
<!-- add lib/ prefix -->
<globmapper from="*" to="lib/*" />
</chainedmapper>
</mapper>
<path refid="classpath" />
</pathconvert>

<jar jarfile="${build}/${jarname}.jar" basedir="${build.class}" includes="**">
<manifest>
<attribute name="Main-Class" value="${mainclass}" />
<attribute name="Class-Path" value="${libs.project}" />
</manifest>
</jar>
<jar jarfile="${build}/${jarname}-doc.jar" basedir="${build.doc}" includes="**" />
<jar jarfile="${build}/${jarname}-src.jar" basedir="${build.src}" includes="**" />
</target>

<target name="clean" description="clean up">
<delete dir="${build}" />
</target>

<!-- checkstyle -->
<property name="checkstyle-5.3.home" value="${env.YOYO_SVN_HOME}/app/java/checkstyle/checkstyle-5.3" />

<fileset id="checkstyle-5.3.jar" dir="${checkstyle-5.3.home}">
<include name="checkstyle-5.3-all.jar" />
</fileset>

<property name="checkstyle-latest.home" value="${checkstyle-5.3.home}" />
<fileset id="checkstyle-latest.jar" refid="checkstyle-5.3.jar" />
<taskdef resource="checkstyletask.properties" classpath="${checkstyle-5.3.home}/checkstyle-5.3-all.jar" />

<target name="checkstyle" depends="build">
<checkstyle config="${env.YOYO_SVN_HOME}/app/java/checkstyle/checkstyle.xml" failOnViolation="false">
<fileset dir="${build.src}/com/yoyosys/virt">
<include name="**/*.java" />
</fileset>
<formatter type="plain" />
<formatter type="xml" toFile="${build}/checkstyle_report.xml" />
</checkstyle>
<xslt in="${build}/checkstyle_report.xml" out="${build}/checkstyle_report.html" style="${basedir}/checkstyle-noframes-severity-sorted.xsl" />
<delete file="${build}/checkstyle_report.xml" />
</target>

<!-- findbugs -->
<property name="findbugs.home" value="${env.YOYO_SVN_HOME}/app/java/findbugs/findbugs-2.0.0" />
<path id="findbugs-jar">
<pathelement path="${findbugs.home}/lib/findbugs-ant.jar" />
</path>
<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpathref="findbugs-jar" />

<target name="findbugs" depends="build">
<findbugs home="${findbugs.home}" jvmargs="-server -Xss512m -Xmx1024m" output="xml:withMessages" outputFile="${build}/findbugs_report.xml" excludefilter="${basedir}/findbugs_exclude.xml" auxClasspathRef="classpath">
<sourcePath path="${build.src}" />
<class location="${build.class}" />
</findbugs>
<xslt in="${build}/findbugs_report.xml" out="${build}/findbugs_report.html" style="${basedir}/findbugs-fancy-hist.xsl" />
<delete file="${build}/findbugs_report.xml" />
</target>
</project>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值