我有一个带有 java 和 scala 的多模块项目。jacoco 和 scoverage 插件都安装在 Jenkins 中,我想在 Jenkins 的单个构建作业中生成 jacoco 和 scoverage 报告(两者),但只生成一个报告,要么是 jacoco,要么是 scoverage。
到目前为止尝试过的 mvn 命令下面 -
mvn -B -s $MVN_SETTINGS jacoco:prepare-agent install scoverage:report jacoco:report
和
mvn -B -s $MVN_SETTINGS jacoco:prepare-agent install jacoco:report scoverage:report
我的 pom 文件的片段 -
Plugins section -
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.9</version>
<configuration>
<destFile>./target/jacoco.exec</destFile>
<append>true</append>
</configuration>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>default-report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.scoverage</groupId>
<artifactId>scoverage-maven-plugin</artifactId>
<version>1.3.0</version>
<configuration>
<scalaVersion>2.10.4</scalaVersion>
<highlighting>true</highlighting>
<aggregate>true</aggregate>
</configuration>
</plugin>
</plugins>
Reporting section -
<reporting>
<outputDirectory>${project.build.directory}/site</outputDirectory>
<plugins>
<plugin>
<groupId>org.scoverage</groupId>
<artifactId>scoverage-maven-plugin</artifactId>
<version>1.3.0</version>
<configuration>
<aggregate>true</aggregate>
</configuration>
<reportSets>
<reportSet>
<reports>
<report>report</report>
</reports>
</reportSet>
</reportSets>
</plugin>
<plugin>
</plugins>
</reporting>
当我使用 -
mvn -B -s $MVN_SETTINGS jacoco:prepare-agent install scoverage:report jacoco:report
生成 jacoco 报告
构建日志 -
05:30:51 [编译] [INFO] --- scoverage-maven-plugin:1.3.0:report (default-cli) @ ABC --- 05:30:51 [编译] [INFO] 读取 scoverage 工具 [ /workspace/Build-Pipeline/ABC/target/scoverage-data/scoverage.coverage.xml]... 05:30:51 [编译] [INFO] 读取覆盖测量值 [/workspace/Build-Pipeline/ABC/target/ scoverage-data/scoverage.measurements.*]... 05:30:51 [编译] [INFO] 生成覆盖率报告... 05:30:51 [编译] [INFO] 书面 Cobertura XML 报告 [/workspace/Build -Pipeline/ABC/target/cobertura.xml] 05:30:52 [编译] [INFO] 书面 XML 覆盖率报告 [/workspace/Build-Pipeline/ABC/target/scoverage.xml] 05:30:53 [编译] [INFO] 书面 HTML 覆盖率报告 [/workspace/Build-Pipeline/ABC/target/site/scoverage/index.html] 05:30:53 [编译] [INFO] 语句覆盖率。:0.00% 05:30:53 [编译] [INFO] 分支覆盖率....:0.00% 05:30:53 [编译] [INFO] 覆盖率报告已完成。
当我使用 -
mvn -B -s $MVN_SETTINGS jacoco:prepare-agent install jacoco:report scoverage:report
生成覆盖率报告
构建日志 -
05:15:07 [编译] [INFO] --- scoverage-maven-plugin:1.3.0:report (default-cli) @ ABC --- 05:15:07 [编译] [INFO] 读取 scoverage 工具 [ /workspace/Build-Pipeline/ABC/target/scoverage-data/scoverage.coverage.xml]... 05:15:07 [编译] [INFO] 读取覆盖测量值 [/workspace/Build-Pipeline/ABC/target/ scoverage-data/scoverage.measurements.*]... 05:15:07 [编译] [INFO] 生成覆盖率报告... 05:15:07 [编译] [INFO] 书面 Cobertura XML 报告 [/workspace/Build -Pipeline/ABC/target/cobertura.xml] 05:15:08 [编译] [INFO] 书面 XML 覆盖率报告 [/workspace/Build-Pipeline/ABC/target/scoverage.xml] 05:15:08 [编译] [INFO] 书面 HTML 覆盖率报告 [/workspace/Build-Pipeline/ABC/target/site/scoverage/index.html] 05:15:08 [编译] [INFO] 语句覆盖率。:0.00% 05:15:08 [编译] [INFO] 分支覆盖率....:0.00% 05:15:08 [编译] [INFO] 覆盖率报告已完成。
有人可以指出我出了什么问题吗?
非常感谢