2010-02-24 10:11:35 MST
Hello all. I'm new to EMMA and ANT, so I won't be surprised if I totally missed something here. I'm testing out a very basic piece of code to try to get a report out of EMMA on what code is being covered in the test. I tried using the ANT script below to get the HTML report but whenever I run it, I get nothing.

What am I missing here?

<?xml version="1.0" encoding="UTF-8"?>
<project name="JCT Project" default="run" basedir=".">

    <!-- Description -->
    <description>
        Build script for the Java Code Coverage Tool
    </description>

    <!-- Directories -->
    <property name="out.dir" value="${basedir}/out" />
    <property name="src.dir" value="${basedir}/jct" />
    <property name="emma.dir" value="${basedir}/lib" />
    <property name="coverage.dir" value="${basedir}/coverage" />
    <!-- Setup the Path -->
    <path id="emma.lib" >
        <pathelement location="${emma.dir}/emma.jar" />
        <pathelement location="${emma.dir}/emma_ant.jar" />
    </path>

    <taskdef resource="emma_ant.properties" classpathref="emma.lib" />

    <target name="emma" description="turns on EMMA's on-the-fly instrumentation mode" >
        <property name="emma.enabled" value="true" />
    </target>

    <!-- Initialize -->
    <target name="init" >
        <mkdir dir="${out.dir}" />
        <mkdir dir="${out.dir}/jct" />
        <path id="run.classpath" >
            <pathelement location="${out.dir}" />
        </path>
        <mkdir dir="${coverage.dir}" />
    </target>

    <!-- Compile the JCT file -->
    <target name="compile" description="compile the source" >
        <javac srcdir="${src.dir}" debug="on" />
        <move file="jct/JCT.class" todir="${out.dir}/jct" />
    </target>

    <!-- Build a Jar -->
    <target name="run" depends="init, compile" description="run the source" >
        <emmajava enabled="${emma.enabled}" 
                  libclasspathref="emma.lib"
                  fullmetadata="yes" 
                  sourcepath="${src.dir}" 
                  classname="jct.JCT" 
                  classpathref="run.classpath">
            <txt outfile="${coverage.dir}/coverage.txt" />
            <xml outfile="${coverage.dir}/coverage.xml" />
            <html outfile="${coverage.dir}/coverage.html"  />
        </emmajava>
    </target>

</project>