dwdyer edited this page Aug 14, 2010 · 5 revisions


Deletes all build artifacts for a specified module.


Compiles the main source tree and test source tree for a specified module (dealing with all necessary classpath configuration).


Builds a JAR file for a specified module. Includes main classes and omits test class. Sets the Class-Path and Main-Class manifest properties as required.


Builds a source JAR for a specified module, omitting test sources.


Runs TestNG unit tests, generates reports using ReportNG and measures code coverage with Cobertura.


Simplified Javadoc invocation (requires fewer lines of XML than using the Ant Javadoc task directly).


Copies all build artifacts and dependencies from each module into the “dist” directory so that that directory contains a complete self-contained build of the entire project.


Builds release archives (ZIP and TGZ) that contain the contents of the “dist” directory plus any API docs and any text files from the project root (e.g. LICENCE.txt, README.txt, CHANGELOG.txt).


Constructs a Maven POM and uploads the module JAR file to a Maven repository with source JAR and test source JAR attached.


Add the uncommons namespace to the root project element:

<project name="myproject" xmlns:uncommons="antlib:org.uncommons.antlib">

Load the macros and taskdefs:

<path id="tool.path">
  <fileset dir="lib" includes="**/*.jar" />
<taskdef uri="antlib:org.uncommons.antlib"

Use the macros:

<uncommons:clean module="framework" />
<uncommons:compile module="framework" />
<uncommons:jar module="framework" />
<uncommons:test suites="testng.xml" title="My Unit Test Report" mincoverage="80" />

This example will delete any existing build artifacts from the “framework” module, compile all module sources and test sources (with a classpath that includes any libs in the global lib directory and module lib directory) and build a file called “framework.jar”. It then runs the unit test suites specified by “testng.xml”, generating test and coverage HTML reports. The build will fail if any of the tests fail or if branch or line coverage is below 80%.

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.