Today I set up this Maven plugin to gain insight into the test coverage of my Scala code.
Amend the respective pom.xml as follows:
<project>
...
<properties>
...
<scoverage.plugin.version>1.4.0</scoverage.plugin.version>
<scoverage.scalacPluginVersion>1.4.0</scoverage.scalacPluginVersion>
<scoverage.aggregate>true</scoverage.aggregate>
...
</properties>
...
<build>
<plugins>
...
<plugin>
<groupId>org.scoverage</groupId>
<artifactId>scoverage-maven-plugin</artifactId>
<version>${scoverage.plugin.version}</version>
<configuration>
<scalaVersion>${scala.version}</scalaVersion>
<scalacPluginVersion>${scoverage.scalacPluginVersion}</scalacPluginVersion>
</configuration>
</plugin>
...
</plugins>
</build>
<reporting>
<plugins>
...
<plugin>
<groupId>org.scoverage</groupId>
<artifactId>scoverage-maven-plugin</artifactId>
<version>${scoverage.plugin.version}</version>
<reportSets>
<reportSet>
<reports>
<report>report</report>
<!-- or <report>integration-report</report> -->
<!-- or <report>report-only</report> -->
</reports>
</reportSet>
</reportSets>
</plugin>
...
</plugins>
</reporting>
...
</project>
You can then use the following commands to run the checks and generate HTML reports:
mvn scoverage:check
mvn scoverage:report
More info here: https://github.com/scoverage/scoverage-maven-plugin
Enjoy!