ravinikam
ravinikam

Reputation: 3696

emma not generating reports but cobertura does?

basic reason to put the comparison question between these 2 is I am able to generate the reports in site directory(for cobertura) after putting the following plug in information in build section of my pom. But same would not happening with emma. I checked documentation in codehause mojo its almost same for both. My configuration is :

<plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>emma-maven-plugin</artifactId>
            <version>1.0-alpha-2</version>
            <executions>
                <execution>
                    <phase>process-classes</phase>
                    <goals>
                        <goal>emma</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

but it dont generate reports as expected in site directory but I can see coverage.em generated and classes instrumented every time. am I missing any configuration ?

Upvotes: 2

Views: 2664

Answers (2)

ravinikam
ravinikam

Reputation: 3696

this is really strange: corrected plugin entry is : see the output directory

<plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>emma-maven-plugin</artifactId>
            <version>1.0-alpha-2</version>
            <inherited>true</inherited>
            <executions>
                <execution>
                    <id>emma</id>
                    <phase>process-classes</phase>
                    <goals>
                        <goal>emma</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <outputDirectory>${project.build.directory}</outputDirectory>
            </configuration>
        </plugin>

emma even does not accept ${project.build.directory}/emma.

conclusion : emma not generated reports when you add any sub-directory to ${project.build.directory} e.g. ${project.build.directory}/emma-reports.

Upvotes: 0

Pascal Thivent
Pascal Thivent

Reputation: 570545

I can't reproduce your problem. I copied and pasted your configuration snippet into a random pom.xml and running any phase posterior to process-classes triggers emma:emma and the coverage report is generated as expected:

$ mvn clean process-classes
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Test Project
[INFO]    task-segment: [clean, process-classes]
[INFO] ------------------------------------------------------------------------
[INFO] [clean:clean {execution: default-clean}]
[INFO] Deleting directory /home/pascal/tmp/test-project/target
[INFO] [resources:resources {execution: default-resources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Compiling 1 source file to /home/pascal/tmp/test-project/target/classes
[INFO] Preparing emma:emma

...

EMMA: runtime coverage data merged into [/home/pascal/tmp/test-project/coverage.ec] {in 93 ms}
[INFO] [emma:emma {execution: default}]
processing input files ...
2 file(s) read and merged in 3 ms
writing [xml] report to [/home/pascal/tmp/test-project/target/site/emma/coverage.xml] ...
writing [html] report to [/home/pascal/tmp/test-project/target/site/emma/index.html] ...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------

Do you have unit tests in your project? Is the coverage.em file non empty? What happens if you run emma:emma on the command line? Does running mvn with the -X option give you any hint? Can you post some traces that would be helpful?

As a side note, I wouldn't run emma:emma as part of the regular build personally. I would either run the emma:emma goal from the command line or configure the plugin and the reporting section as suggested in the Usage page. But that's another story and doesn't answer the question.

Upvotes: 1

Related Questions