如何使用scoverage maven插件生成xml报告?

时间:2016-04-29 08:11:15

标签: scala maven scoverage

我正在尝试生成scoverage xml报告以在Jenkins中使用它。但我能得到的就是带有.scala文件的文件夹scoverage-classes。这是我的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生成xml报告,但Scoverage没有。我试图用不同的args运行maven,比如mvn scoverage:report,mvn scoverage:report site等等。什么都没有帮助。我应该在我的pom中做些什么来改变它?

1 个答案:

答案 0 :(得分:0)

事实证明我有scava编译器插件,scoverage插件不支持。它看起来像org.scala-tools的maven scala编译器插件已经过时了。 scoverage插件支持:

  • net.alchim31.maven:阶-行家-插件

  • com.google.code.sbt编译-行家-插件:SBT-编译器行家-插件