【问题标题】:Pictures are not appearing in Jacoco coverage report (neither in Index.html nor in VSTS)图片未出现在 Jacoco 覆盖报告中(既不在 Index.html 也不在 VSTS 中)
【发布时间】:2019-12-26 14:08:58
【问题描述】:

我正在为一个 Maven 项目设置 Jacoco 覆盖范围。我想在 VSTS 中发布此报道。 我成功地获得了正确的覆盖范围,并且它为我项目的所有子模块发布,但没有出现图片(Jacoco 生成的 Index.html 文件和 VSTS 板中都没有)。见screenshot

你遇到过这样的问题吗?请问如何解决这个问题?

谢谢!

在 VSTS 管道中添加的任务:

  # Publish code coverage results
  # Publish Cobertura or JaCoCo code coverage results from a build
  - task: PublishCodeCoverageResults@1
    inputs:
      codeCoverageTool: 'JaCoCo'
      summaryFileLocation: '**/jacoco-ut/*.xml'
      reportDirectory: '**/jacoco-ut/'
      additionalCodeCoverageFiles: '**/coverage-reports/jacoco-ut.exec'
      failIfCoverageEmpty: false

聚合器模块的 POM 配置:

     <plugin>
      <groupId>org.jacoco</groupId>
      <artifactId>jacoco-maven-plugin</artifactId>
      <executions>
       <execution>
        <id>report-aggregate</id>
        <phase>prepare-package</phase>
         <goals>
          <goal>report-aggregate</goal>
         </goals>
       <configuration>
        <dataFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</dataFile>
         <outputDirectory> ${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
       </configuration>
      </execution>
     </executions>
    </plugin>

Maven 父模块的 POM:

     <plugin>
      <groupId>org.jacoco</groupId>
      <artifactId>jacoco-maven-plugin</artifactId>
      <version>${jacoco.version}</version>
      <executions>
       <execution>
        <goals>
         <goal>prepare-agent</goal>
        </goals>
       </execution>
      </executions>
     </plugin>

对于每个子模块,在 POM 配置下:

     <plugin>
      <groupId>org.jacoco</groupId>
      <artifactId>jacoco-maven-plugin</artifactId>
      <executions>
       <execution>
         <id>report</id>
        <phase>test</phase>
        <goals>
          <goal>report</goal>
        </goals>
       </execution>
      </executions>
     </plugin>

【问题讨论】:

标签: azure-devops azure-pipelines jacoco maven-surefire-plugin jacoco-maven-plugin


【解决方案1】:

我发现这是出于安全考虑的 VSTS 限制。此处报告了相同的问题:https://developercommunity.visualstudio.com/content/problem/363333/jacoco-css-and-resources-missing-after-publishcode.html

【讨论】:

    猜你喜欢
    • 2018-09-09
    • 2020-01-14
    • 2022-06-15
    • 2019-04-10
    • 2016-05-14
    • 1970-01-01
    • 2010-11-14
    • 2018-07-27
    • 1970-01-01
    相关资源
    最近更新 更多