2

我正在尝试生成 scoverage xml 报告以在 Jenkins 中使用它。但我能得到的只是文件夹 scoverage-classes 和我的 .scala 文件。这是我的 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 不生成。我尝试使用不同的参数运行 maven,例如 mvn scoverage:report、mvn scoverage:report site 等等。没有什么帮助。我应该在我的 pom 中进行哪些更改才能使其正常工作?

4

1 回答 1

1

原来我有 scoverage 插件不支持的 scala 编译器插件。此外,来自 org.scala-tools 的 maven scala 编译器插件看起来也已过时。scoverage 插件支持的有:

  • net.alchim31.maven:scala-maven-plugin

  • com.google.code.sbt-compiler-maven-plugin:sbt-compiler-maven-plugin

于 2016-04-29T10:05:27.373 回答