100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > ant脚本实现自动编译

ant脚本实现自动编译

时间:2018-10-25 16:31:45

相关推荐

ant脚本实现自动编译

<?xml version="1.0"?>

<project name="portal" default="junit" basedir=".">

<property name="source.dir" value="src" />

<property name="build.dir" value="build" />

<property name="lib.dir" value="lib" />

<property name="classes.dir" value="${build.dir}/classes" />

<property name="report.dir" value="report" />

<!-- ================================================================== -->

<!-- C L E A N -->

<!-- ================================================================== -->

<target name="clean">

<delete dir="${classes.dir}" />

<mkdir dir="${classes.dir}" />

<delete dir="${report.dir}" />

<mkdir dir="${report.dir}" />

</target>

<!-- ================================================================== -->

<!-- C O M P I L E -->

<!-- ================================================================== -->

<target name="compile" depends="clean">

<!-- local project jars -->

<patternset id="pile">

<include name="*.jar" />

</patternset>

<fileset dir="${lib.dir}" id="pile">

<patternset refid="pile" />

</fileset>

<pathconvert targetos="windows" property="pile" refid="pile" />

<!-- compile -->

<javac srcdir="${source.dir}" destdir="${classes.dir}" classpath="${pile}" includes="**/*.java" debug="true">

</javac>

</target>

<!-- ================================================================== -->

<!-- J U N I T -->

<!-- ================================================================== -->

<target name="junit" depends="compile">

<junit printsummary="on" fork="true" haltonfailure="false" failureproperty="tests.failed" showoutput="true">

<classpath>

<pathelement path="${classes.dir}" />

<fileset dir="${lib.dir}">

<include name="**/*.jar" />

</fileset>

</classpath>

<formatter type="xml" />

<batchtest todir="${report.dir}">

<fileset dir="${classes.dir}">

<include name="**/*Test.*" />

</fileset>

</batchtest>

</junit>

<junitreport todir="${report.dir}">

<fileset dir="${report.dir}">

<include name="TEST-*.xml" />

</fileset>

<report format="frames" todir="${report.dir}" />

</junitreport>

<fail if="tests.failed">

</fail>

</target>

</project>

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。