Reputation: 113
To generate emma report I ran these command.
1. mvn install -Pwith-emma
2. java -cp %USERPROFILE%/.m2/repository/emma/emma/2.1.5320/emma-2.1.5320.jar emma report -r xml,html -in coverage.ec -in target/coverage.em
After ran command I am able to generate emma report and also able excluding packages as I want, And it give me whole class coverage report. But the issue is when I click on any particular class to see file report(code coverage) I am getting:
[source file 'com/test/test.java' not found in sourcepath] When I generate emma report.
Here is the my pom.xml entry regarding emma-maven-plugin<
<profile>
<id>with-emma</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>emma-maven-plugin</artifactId>
<inherited>true</inherited>
<executions>
<execution>
<id>instrument</id>
<phase>process-test-classes</phase>
<configuration>
<filters>
<filter>-com.test.generated.ceq.*</filter>
<filter>-com.activities.*</filter>
</filters>
</configuration>
<goals>
<goal>instrument</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
After checked many link I feel there is issue with command
2. java -cp %USERPROFILE%/.m2/repository/emma/emma/2.1.5320/emma-2.1.5320.jar emma report -r xml,html -in coverage.ec -in target/coverage.em
But tried many but not able to resolve this issue. Thanks.
Upvotes: 8
Views: 879
Reputation: 1568
AFAIK, you should add in the 'emma report' command line the -sp flag to include the sources in the report:
java -cp %USERPROFILE%/.m2/repository/emma/emma/2.1.5320/emma-2.1.5320.jar emma report -r xml,html -sp /<path-to-project>/src/main/java/ -sp /<path-to-another-project>/src/main/java/ -in coverage.ec -in target/coverage.em
Upvotes: 1
Reputation: 186
Dani,
I do not understand - are you using the command-line options of EMMA or you want to use the emma maven plugin?
If it's the first one just run your command and include the filters there. You can use this refference: http://emma.sourceforge.net/reference_single/reference.html#tool-ref.instr.cmdline
If you want to use maven check this: http://mojo.codehaus.org/emma-maven-plugin/usage.html. I would emphasize on the following paragraph:
"It is important to execute the tests in a seperate jvm because EMMA dumps the coverage on termination of the JVM. The tests need a different classes directory to load the instrumented classes. (The classes are not instrumented in place because we don't want intrumented classes in the released jars.)"
Upvotes: 0