Details
-
Type:
New Feature
-
Status:
Closed
-
Priority:
Major
-
Resolution: Duplicate
-
Affects Version/s: 2.3
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
It would be useful to have a "report" goal in the plugin, to be able to completely manage the lifecycle of the coverage.
I've run into the problem described in MCOBERTURA-80 and found a workaround which could be greatly simplified by the introduction of this goal. I run cobertura during the integration phase, instead of the test phase, and avoid the recompilation (both compile:compile and aspect:compile) that happens in the forked lifecycle of the cobertura goal:
<build> <plugins> <!-- Other plugins invoked in earlier phases of the lifecycle --> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>cobertura-maven-plugin</artifactId> <version>2.3</version> <executions> <execution> <id>cobertura-instrument</id> <phase>pre-integration-test</phase> <goals> <goal>instrument</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <executions> <execution> <id>cobertura-test</id> <phase>integration-test</phase> <goals> <goal>test</goal> </goals> </execution> </executions> </plugin> <!-- - Since there is no report goal in cobertura-maven-plugin, I have to invoke - cobertura itself manually, which is not pretty... --> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.1.1</version> <dependencies> <dependency> <groupId>net.sourceforge.cobertura</groupId> <artifactId>cobertura</artifactId> <version>1.9.2</version> </dependency> </dependencies> <executions> <execution> <id>cobertura-report</id> <phase>post-integration-test</phase> <goals> <goal>java</goal> </goals> <configuration> <mainClass>net.sourceforge.cobertura.reporting.Main</mainClass> <arguments> <argument>--datafile</argument> <argument>${project.build.directory}/cobertura/cobertura.ser</argument> <argument>--destination</argument> <argument>${project.build.directory}/cobertura</argument> <argument>--format</argument> <argument>xml</argument> </arguments> <includeProjectDependencies>false</includeProjectDependencies> <includePluginDependencies>true</includePluginDependencies> </configuration> </execution> </executions> </plugin> </plugins> </build>
The last bit would then become:
<build> <plugins> <!-- ... --> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>cobertura-maven-plugin</artifactId> <version>2.3</version> <executions> <execution> <id>cobertura-instrument</id> <phase>post-integration-test</phase> <goals> <goal>report</goal> </goals> </execution> </executions> </plugin> </plugins> </build>
Issue Links
| This issue duplicates: | ||||
| MCOBERTURA-124 | Report only goal |
|
|
|
Aren't this ticket and MCOBERTURA-124 duplicates?