mavenmaven-pluginscoverage

how to execute scoverage report with optional parameters using maven command


how can I add this optional parameters (e.g minimumCoverage ) with scoverage-maven-plugin . when calling

mvn scoverage:check

Solution

  • Add to pom.xml file, e.g.:

            <plugin>
                <groupId>org.scoverage</groupId>
                <artifactId>scoverage-maven-plugin</artifactId>
                <version>1.3.0</version>
                <configuration>
                    <minimumCoverage>50</minimumCoverage>
                    <failOnMinimumCoverage>true</failOnMinimumCoverage>
                </configuration>
            </plugin>
    

    or add to command line e.g.:

    mvn scoverage:check -Dscoverage.minimumCoverage=50 -Dscoverage.failOnMinimumCoverage=true
    

    or mix both methods. Command line parameters override those defined in pom.xml file.