Skip to content

Instantly share code, notes, and snippets.

@c0debrain
Last active August 29, 2015 14:26
Show Gist options
  • Save c0debrain/d6dc15a6de813b4dc550 to your computer and use it in GitHub Desktop.
Save c0debrain/d6dc15a6de813b4dc550 to your computer and use it in GitHub Desktop.

maven code coverage

mvn cobertura:cobertura
mvn site
<reporting>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>cobertura-maven-plugin</artifactId>
                <version>2.4</version>
            </plugin>
        </plugins>
    </reporting>
    
    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>cobertura-maven-plugin</artifactId>
                <configuration>
                    <instrumentation>
                        <ignores>
                            <ignore>com.test.somepackage.*</ignore>
                        </ignores>
                        <excludes>
                            <exclude>com/test/somepackage/**/*.class</exclude>
                            <exclude>com/test/**/*Test.class</exclude>
                        </excludes>
                    </instrumentation>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>clean</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        
         
    </build>

Maven dashboard

mvn site
mvn dashboard:dashboard
<reporting>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>dashboard-maven-plugin</artifactId>
                <version>1.0.0-beta-1</version>
            </plugin>
        </plugins>
    </reporting>
    
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>dashboard-maven-plugin</artifactId>
                    <version>1.0.0-beta-1</version>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>dashboard-maven-plugin</artifactId>
                <version>1.0.0-beta-1</version>
            </plugin>
        </plugins>
        
         
    </build>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment