Learning from CruiseControl-ant (build. xml)

Source: Internet
Author: User
Tags echo message

CruiseControl has integrated Ant. The CC integration version of 2.8.4 is 1.7.0, not the latest Ant.

Ant scripts are written in an xml file. The default file name is build. xml, which can be customized.

CC provides us with a simple Ant script, as shown below:

<project name="connectfour" default="all">
<target name="all" depends="clean, compile, sleep, test, jar"/>

<target name="clean">
<delete dir="target" quiet="true" />
</target>

<target name="compile">
<mkdir dir="target/classes"/>
<javac srcdir="src" destdir="target/classes"/>
</target>

<target name="sleep">
<echo message="Sleeping for a while so you can see the build in the new dashboard" />
<sleep seconds="60" />
</target>

<target name="test" depends="compile">
<mkdir dir="target/test-classes"/>
<javac srcdir="test" destdir="target/test-classes">
<classpath>
<pathelement location="target/classes"/>
<pathelement location="lib/junit.jar"/>
</classpath>
</javac>

<mkdir dir="target/test-results"/>
<junit haltonfailure="no" printsummary="on">
<classpath >
<pathelement location="target/classes"/>
<pathelement location="lib/junit.jar"/>
<pathelement location="target/test-classes"/>
</classpath>
<formatter type="brief" usefile="false"/>
<formatter type="xml" />
<batchtest todir="target/test-results" >
<fileset dir="target/test-classes" includes="**/*Test.class"/>
</batchtest>
</junit>
</target>

<target name="jar" depends="compile">
<jar jarfile="target/connectfour.jar" basedir="target/classes"/>
</target>
</project>

If you do not know Ant script, you can learn through the following url: http://ant.apache.org/manual/index.html

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.