The Maven EMMA allows EMMA to be integrated into Maven projects. EMMA is an open-source toolkit for measuring and reporting Java code coverage. EMMA distinguishes itself from other tools by going after a unique feature combination: support for large-scale enterprise software development while keeping individual developer's work fast and iterative. Every developer on your team can now get code coverage for free and they can get it fast!
Automatic install: To automatically install the plugin, type the following on a single line:
maven plugin:download -DgroupId=emma -DartifactId=maven-emma-plugin -Dversion={version}
where {version} is the release number you want to install. Maven will automatically download the plugin and install it, uninstalling any other version you may already have.
There are 3 possible ways of running the plugin (Note that if you're in a multiproject setup, running the plugin for multiprojects is not yet supported):
emma
goal or
add the maven-emma-plugin
report to the reports
section in your POM. This will instrument your source code, run your
project's tests on the instrumented code and generate EMMA reports.
emma:test
which will
instrument your source code and run your project's tests on the instrumented code.
You'll then need to call emma:report
to generate the reports
to .../target/docs/coverage.
emma:on
followed by whatever other
goal you wish (for example maven emma:on war
.) This will instrument
your source code. Then you'll run any goal that tests your artifacts. For example
in the case of a WAR you can use HttpUnit/HtmlUnit to run functional tests. The
test of your artifact will fill the EMMA database with data. Finally you'll run
emma:report
to generate the reports to .../target/docs/coverage..
If you have detailed questions about how EMMA operates, or problems, please review the main EMMA FAQ and documentation at http://emma.sourceforge.net/. The maven EMMA plugin simply wraps the EMMA Ant tasks, so it behaves in a very similar way. Specifically, if you have questions about getting EMMA coverage from tests run in an application server, search the main EMMA FAQ for 'application server'.
All EMMA jars and plugins will be uploaded to the central Maven repository at http://www.ibiblio.org/maven/emma/. However, if they are not availalbe on ibiblio for some reason, there is also an alternate repository hosted at http://emma.sourceforge.net/maven/
If you want to use this repository, simply add it to your comma-delimited maven.repo.remote property. For example:
maven.repo.remote=http://www.ibiblio.org/maven/, http://emma.sourceforge.net/maven/