????3??build.xml

 

<?xml version="1.0" encoding="UTF-8"?>
<project name="AntDemo" default="junit" basedir=".">
<!-- =================================================================== -->
<!-- ????????  -->
<!-- =================================================================== -->
<!-- ?????src·?? -->
<property name="src.path" value="src/java"/>
<!-- ??????????·?? -->
<property name="test.path" value="src/test"/>
<!-- ???????class·?? -->
<property name="build.path" value="build"/>
<!-- jar??·?? -->
<property name="dist.path" value="dist"/>
<!-- lib??·?? -->
<property name="lib.path" value="lib"/>
<!-- ???????junit4.xml·?? -->
<property name="report.path" value="report"/>
<!-- =================================================================== -->
<!-- ????classpath -->
<!-- =================================================================== -->
<path id="compile.path">
<fileset dir="${lib.path}">
<include name="**/*.jar"/>
</fileset>
<pathelement path="${build.path}"/>
</path>
<!-- ????? -->
<target name="init">
<mkdir dir="${build.path}"/>
<mkdir dir="${report.path}"/>
<mkdir dir="${dist.path}"/>
</target>
<!-- =================================================================== -->
<!-- ??????????class -->
<!-- =================================================================== -->
<target name="clean" description="clean">
<delete dir="${build.path}"/>
<delete dir="${report.path}"/>
<delete dir="${dist.path}"/>
</target>
<!-- =================================================================== -->
<!-- ??????????????????? -->
<!-- =================================================================== -->
<target name="compile" depends="init">
<javac srcdir="${src.path}" destdir="${build.path}"  classpathref="compile.path" includeantruntime="true"/>
<javac srcdir="${test.path}" destdir="${build.path}"  classpathref="compile.path" includeantruntime="true"/>
</target>
<!-- =================================================================== -->
<!-- ??в?????? -->
<!-- =================================================================== -->
<target name="junit" depends="compile">
<junit printsummary="true" fork="true">
<formatter type="xml" usefile="true"/>
<classpath refid="compile.path"/>
<batchtest fork="on" todir="${report.path}" haltonfailure="no">
<fileset dir="${build.path}">
<include name="**/*Test.class"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="junit-report" depends="junit">
<!-- ????????????????? -->
<junitreport todir="${report.path}">
<fileset dir="${report.path}">
<include name="TEST-*.xml" />
</fileset>
<report format="frames" todir="${report.path}" />
</junitreport>
</target>
<target name="make-jar" depends="compile" description="make jar file">
<jar jarfile="${dist.path}/AntDemo.jar">
<fileset dir="${build.path}">
<!--???test???-->
<exclude name="**/*Test.class"/>
</fileset>
</jar>
</target>
</project>

????????????Jenkins??
????PS??Jenkins???????master/slave??????????job???У???????????master????Jenkins??????????
????1????jenkins???????????job??????Item???????? ?????????????????????????"OK"

????2???? ?????? ???????Subversion????Repository URL???棬???????SVN?????

????PS:Repository URL?????????????????????????????????????????????????????????svn: E180001: Unable to open an ra_local session to URL???????????????????????????????????????SVN???????????????????????????????
????3???? ???? ?????????????????????
????I?????Execute Windows batch command?????????????????????(???????????????????)??
????set path=C:ANT_HOMEApache-Ant-1.7.0in;path??????ant??????????path
????ant junit???????????????????????????????????????????????????junit task

????II??????I????鷳????????????ú???ANT_HOME?????????Invoke Ant???????targets???????????build.xml???task name??

????4????????棬??????????????????н????