PROBLEM
The Cobertura Maven Plugin doesn’t respect the exclusion configuration. For example, if you have the following pom.xml, the exclusion configuration does absolutely nothing when you execute mvn site
.
<project ...> ... <reporting> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>cobertura-maven-plugin</artifactId> <version>2.5.2</version> <configuration> <instrumentation> <excludes> <exclude>**/wsdl2java/**</exclude> </excludes> </instrumentation> <formats> <format>html</format> <format>xml</format> </formats> <check/> </configuration> </plugin> </plugins> </reporting> </project>
SOLUTION
To fix this, you will need to define the Cobertura Maven Plugin under both <build>
and <reporting>
.
<project ...> ... <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>cobertura-maven-plugin</artifactId> <version>2.5.2</version> <configuration> <instrumentation> <excludes> <exclude>**/wsdl2java/**</exclude> </excludes> </instrumentation> <formats> <format>html</format> <format>xml</format> </formats> <check/> </configuration> </plugin> </plugins> </build> <reporting> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>cobertura-maven-plugin</artifactId> <version>2.5.2</version> <configuration> <instrumentation> <excludes> <exclude>**/wsdl2java/**</exclude> </excludes> </instrumentation> <formats> <format>html</format> <format>xml</format> </formats> <check/> </configuration> </plugin> </plugins> </reporting> </project>