Menu

[Ant] Could not create instr task

Ryan Lowe
2004-10-05
2013-05-09
  • Ryan Lowe

    Ryan Lowe - 2004-10-05

    Hi Vlad,

    I'm a EMMA newbie and I'm having a problem with EMMA 2.0.4217 offline processing mode using Ant 1.6.1.  Ant is reporting that it could not create the <instr> task.

    I'm running the Ant build.xml script in Eclipse 3.0.0, which comes with Ant 1.6.1.  Eclipse is using JSDK 1.4.2_04 to run the Ant script.

    EMMA is "installed" in:
    C:\Development\eclipse\workspace\homegrown-build\emma-2.0.4217

    I also copied emma.jar to:
    [SDK directory that Eclipse uses for Ant]\lib\ext

    There is nothing else in the "ext" directory -- i had to create it.

    ----

    I made the Ant script look like your example in the User Guide.  Here are the relevant parts:

    [...other stuff...]

        <!-- emma -->
        <property name="emma.dir" location="${tools.dir}/emma-2.0.4217/lib"/>
        <path id="emma.lib">
            <pathelement location="${emma.dir}/emma.jar"/>
            <pathelement location="${emma.dir}/emma_ant.jar"/>
        </path>

    [...other stuff...]

        <taskdef resource="emma_ant.properties" classpathref="emma.lib"/>
       
        <target name="emma-instrument" depends="compile-src-debug">
            <mkdir dir="${src.emma_instrumented_classes.dir}"/>
            <mkdir dir="${tests.emma.dir}"/>
            <instr instrpath="${src.classes_debug.dir}"
                    destdir="${src.emma_instrumented_classes.dir}"
                    metadatafile="${tests.emma.dir}/metadata.emma"
                    merge="true"/>
        </target>

    [...other stuff...]

    ----

    ${tools.dir} is just:
    C:\Development\eclipse\workspace\homegrown-build

    ----

    If I run the build script I get the typical Ant error for missing tasks:

    BUILD FAILED: C:\Development\eclipse\workspace\org.audioman\build.xml:29: Following error occured while executing this line
    C:\Development\eclipse\workspace\org.audioman\basicbuild.xml:128: Could not create task or type of type: instr.

    Ant could not find the task or a class this task relies upon.

    This is common and has a number of causes...(etc...)

    ----

    I have also tried adding emma.jar to:

    [Eclipse's Ant plugin directory]\lib

    and this problem still persists.

    Any idea what I'm doing wrong?  Thanks very much in advance!

    Ryan Lowe
    ryan@audioman.org

     
    • Ryan Lowe

      Ryan Lowe - 2004-10-05

      Sorry, I made a typical noob mistake.  I didn't realise that the <instr> tag MUST be surrounded by an <emma> tag.  I changed my buildfile to:

              <emma enabled="true" >
                  <instr instrpath="${src.classes_debug.dir}"
                          destdir="${src.emma_instrumented_classes.dir}"
                          metadatafile="${tests.emma.dir}/metadata.emma"
                          merge="true"/>
              </emma>

      ...and now it works.

       

Log in to post a comment.