I have a Sonar profile in Maven. Everything works fine except the code coverage metric. I want to make Sonar ignore some classes only for the code coverage metric. I have the following profile:
<profile> <id>sonar</id> <properties> <sonar.exclusions>**/beans/jaxb/**</sonar.exclusions> </properties> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>${maven.surefire.plugin.version}</version> <configuration> <redirectTestOutputToFile>true</redirectTestOutputToFile> <excludes> <exclude>**/*Suite*.java</exclude> <exclude>**/*RemoteTest.java</exclude> <exclude>**/*SpringTest.java</exclude> <exclude>**/*CamelTest.java</exclude> <exclude>**/*FunctionalTest.java</exclude> <exclude>**/*IntegrationTest.java</exclude> <exclude>**/*DaoBeanTest.java</exclude> </excludes> </configuration> </plugin> </plugins> </build> </profile> Please help. I tried to add something like
<exclude>com/qwerty/dw/publisher/Main.class</exclude> but it didn't help
UPDATE
I have a correct Cobertura profile. I tried to add it to the Sonar profile, but still I have 53% instead about 95% like in the Cobertura profile
<profile> <id>sonar</id> <properties> <sonar.exclusions>**/beans/jaxb/**</sonar.exclusions> <sonar.core.codeCoveragePlugin>cobertura</sonar.core.codeCoveragePlugin> </properties> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>${maven.surefire.plugin.version}</version> <configuration> <redirectTestOutputToFile>true</redirectTestOutputToFile> <excludes> <exclude>**/*Suite*.java</exclude> <exclude>**/*RemoteTest.java</exclude> <exclude>**/*SpringTest.java</exclude> <exclude>**/*CamelTest.java</exclude> <exclude>**/*FunctionalTest.java</exclude> <exclude>**/*IntegrationTest.java</exclude> <exclude>**/*DaoBeanTest.java</exclude> </excludes> </configuration> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>cobertura-maven-plugin</artifactId> <version>${cobertura.maven.plugin.version}</version> <configuration> <instrumentation> <excludes> <exclude>com/qwerty/dw/dao/*</exclude> <exclude>com/qwerty/dw/domain/*</exclude> <exclude>com/qwerty/dw/beans/**/*</exclude> <exclude>com/qwerty/dw/daemon/exception/*</exclude> <exclude>com/qwerty/dw/daemon/Main.class</exclude> <exclude>com/qwerty/dw/sink/Main.class</exclude> <exclude>com/qwerty/dw/publisher/Main.class</exclude> <exclude>com/qwerty/dw/publisher/dao/*</exclude> <exclude>com/qwerty/dw/publisher/domain/*</exclude> </excludes> </instrumentation> <formats> <format>html</format> </formats> <aggregate>true</aggregate> <check> <haltOnFailure>true</haltOnFailure> <branchRate>60</branchRate> <lineRate>60</lineRate> <totalBranchRate>60</totalBranchRate> <totalLineRate>60</totalLineRate> </check> </configuration> <executions> <execution> <goals> <goal>clean</goal> <goal>check</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </profile>