- Install the Emma plugin through the Update Center or download it into the SONAR_HOME/extensions/plugins directory
- Restart the Sonar server
To make the default code coverage tool:
- Log in as an administrator
- Go to Settings > Configuration > General Settings > Java
- Set the 'sonar.java.coveragePlugin' property to 'emma'
To activate Emma on some projects:
- Add the 'sonar.java.coveragePlugin=emma' when executing the maven plugin. This can be set in pom.xml or in command line.
Or use the 'reuseReports' mode:
Code Block title reuseReports mode language html/xml
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis> <!-- Path to the directory with .ec and .em Emma files --> <sonar.emma.reportPath>emmaDir</sonar.emma.reportPath>
Note that only reports of offline instrumentation are currently supported (*.ec and *.em files). XML or HTML formats are not.
See also the Code Coverage by Unit Tests tutorial.
Branch coverage is not calculated as such notion does not exist in Emma.