Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 37059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T14:29:29+00:00 2026-05-10T14:29:29+00:00

How do I setup an Ant task to generate Emma code coverage reports?

  • 0

How do I setup an Ant task to generate Emma code coverage reports?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T14:29:29+00:00Added an answer on May 10, 2026 at 2:29 pm

    To answer questions about where the source and instrumented directories are (these can be switched to whatever your standard directory structure is):

    <property file='build.properties' /> <property name='source' location='src/main/java' /> <property name='test.source' location='src/test/java' /> <property name='target.dir' location='target' /> <property name='target' location='${target.dir}/classes' /> <property name='test.target' location='${target.dir}/test-classes' /> <property name='instr.target' location='${target.dir}/instr-classes' /> 

    Classpaths:

    <path id='compile.classpath'>   <fileset dir='lib/main'>     <include name='*.jar' />   </fileset> </path>  <path id='test.compile.classpath'>   <path refid='compile.classpath' />   <pathelement location='lib/test/junit-4.6.jar' />   <pathelement location='${target}' /> </path>  <path id='junit.classpath'>   <path refid='test.compile.classpath' />   <pathelement location='${test.target}' /> </path> 

    First you need to setup where Ant can find the Emma libraries:

    <path id='emma.lib' >     <pathelement location='${emma.dir}/emma.jar' />     <pathelement location='${emma.dir}/emma_ant.jar' /> </path> 

    Then import the task:

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

    Then instrument the code:

    <target name='coverage.instrumentation'>     <mkdir dir='${instr.target}'/>     <mkdir dir='${coverage}'/>     <emma>         <instr instrpath='${target}' destdir='${instr.target}' metadatafile='${coverage}/metadata.emma' mode='copy'>             <filter excludes='*Test*'/>         </instr>     </emma>     <!-- Update the that will run the instrumented code -->     <path id='test.classpath'>         <pathelement location='${instr.target}'/>         <path refid='junit.classpath'/>         <pathelement location='${emma.dir}/emma.jar'/>     </path> </target> 

    Then run a target with the proper VM arguments like:

    <jvmarg value='-Demma.coverage.out.file=${coverage}/coverage.emma' /> <jvmarg value='-Demma.coverage.out.merge=true' /> 

    Finally generate your report:

    <target name='coverage.report' depends='coverage.instrumentation'>     <emma>         <report sourcepath='${source}' depth='method'>             <fileset dir='${coverage}' >                 <include name='*.emma' />             </fileset>             <html outfile='${coverage}/coverage.html' />         </report>     </emma> </target> 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 104k
  • Answers 104k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer From the manpage: the complete builtin command can be used… May 11, 2026 at 8:38 pm
  • Editorial Team
    Editorial Team added an answer Why do you want a <div>? <div> is a block-level… May 11, 2026 at 8:38 pm
  • Editorial Team
    Editorial Team added an answer Class instances variables in Objective-C are guaranteed to be initialized… May 11, 2026 at 8:38 pm

Related Questions

Say I have my sources in my src/ tree (and possibly in my test/
I am developing an auto-builder that will run a series of steps in our
We've embedded an OSGi runtime (Equinox) into out custom client-server application to facilitate plugin
I have a series of Eclipse projects containing a number of plugins and features

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.