scalamavenscoverage

How to generate xml report with scoverage maven plugin?


I'm trying to generate scoverage xml report to use it in Jenkins. But all I can get is the folder scoverage-classes with my .scala files. Here is a part of my pom.xml:

<build>
        <plugins>
            <plugin>
                <groupId>org.scala-tools</groupId>
                <artifactId>maven-scala-plugin</artifactId>
                <version>2.15.2</version>
                <executions>
                    <execution>
                        <id>scala-compile</id>
                        <goals>
                            <goal>compile</goal>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.scalatest</groupId>
                <artifactId>scalatest-maven-plugin</artifactId>
                <version>${scalatest.plugin.version}</version>
                <configuration>
                    <junitxml>surefire-reports</junitxml>
                    <stdout>W</stdout>
                </configuration>
                <executions>
                    <execution>
                        <id>test</id>
                        <phase>test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.scoverage</groupId>
                <artifactId>scoverage-maven-plugin</artifactId>
                <version>1.1.1</version>
                <configuration>
                    <scalaVersion>${scala.version}</scalaVersion>
                    <aggregate>true</aggregate>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>2.9</version>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>index</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>

            <plugin>
                <groupId>org.scoverage</groupId>
                <artifactId>scoverage-maven-plugin</artifactId>
                <version>${scoverage.plugin.version}</version>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>report
                            </report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>
        </plugins>
    </reporting>

Scalatest generates xml reports, but Scoverage does not. I've tried to run maven with different args like mvn scoverage:report, mvn scoverage:report site and so on. Nothing helps. What should I change in my pom to make it work?


Solution

  • It turned out that I have scala compiler plugin that is not supported by scoverage plugin. Also it looks like maven scala compiler plugin from org.scala-tools is outdated. Supported by scoverage plugins are: