An Ant task is provided to compile the annotations.

Usage

First you need to activate the custom task in your Ant build.xml file with the following: (refer to Ant documentation on "taskdef" for more details)

<!-- we assume we defined a classpath with the id="backport175.class.path" for backport175 jars -->
<path id="backport175.class.path">
    ...
    <pathelement path="pathToBackport175.jar"/>
    ...
</path>

<!-- define the custom task (annotationc can be changed to what you prefer)
<taskdef name="annotationc" 
         classname="org.codehaus.backport175.compiler.task.AnnotationCTask" 
         classpathref="aw.class.path"/>
<!-- Note: the <taskdef> element can be nested within a <target> element at your convenience -->

<!-- invoke the annotationc defined task -->
<target name="samples:task:annotationc" depends="init, compile:all">
    <annotationc
        verbose="true"
        destdir="${basedir}/target/samples-classes"
        properties="${basedir}/src/samples/annotation.properties"
        copytodest="**/*.dtd">

        <src path="${basedir}/src/samples"/>
        <src path="${basedir}/src/test"/>
        <classpath path="${basedir}/target/samples-classes"/>
        <classpath path="${basedir}/target/test-classes"/>
        <classpath path="${basedir}/target/classes"/>
        <fileset dir="other">
            <include name="**/BAZ.java"/>
        </fileset>
    </annotationc>
</target>

Reference

The AnnotationCTask task accepts the following:

Use the following parameters to configure the classpath to point to the classes to be weaved. Those can be specified with nested elements as well/instead:

Nested elements are similar to the javac task when you configure a classpath and a sourcepath: