Ant error: failed to create task or type emma when run under TeamCity


I'm running Team City 3.x on Windows 2003. I have an ant build script that builds a J2ME project for CLDC/MIDP and also for running unit tests with JUnit. Checking the code coverage check box on the Ant build runner makes the build fail. I've been trying to add code coverage reporting with EMMA inside our build script, so that I can get coverage on my own machine. I'd like to run this under Team City, but it fails with the error "failed to create task or type emma"

The build runs on my dev machine and on the build machine on the command line without errors.

I'm pretty sure it's because of something Team City is doing that it's failing in Team City.

Here's what I've tried :

  • I've tried just running the ant script
  • I've tried to put emma_ant.jar in the TC Ant lib folder.
  • I've tried with a custom Ant location

I've attached the build log and the build file.

Any help with my problem would be appreciated.



Comment actions Permalink

Hello Jason,

   When TeamCity runs build with enabled code coverage, it obfuscates class files and adds a reference to emma.jar .
   But this emma.jar is not in classpath of your obfuscation task and this task fails.

   I'd recommend to create a separate build configuration without obfuscation step (if this is possible), and enable code coverage
   for this build configuration. Anyway, artifacts from coverage-enabled builds should never go to production (be deployed externally).

   If this obfuscation step is mandatory, please add emma.jar (from buildAgent/plugins/coveragePlugin/lib/ ) to the paths used by your obfuscation task.


Comment actions Permalink


I tried running the "test-coverage" target (in the build file attached to my previous post) all by itself in TeamCity and it still fails with the same error. I've attached that log file to this message.

I have my own version of emma.jar and ant_emma.jar in a 'tools' folder in my source repository that the build script uses. Is it possible to use those? I'd rather not have my build script coupled to Team City.



Please sign in to leave a comment.