Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pictures are not appearing in Jacoco coverage report (neither in Index.html nor in VSTS)

I'm setting up Jacoco coverage for a Maven project. I want to publish this coverage in VSTS. I successed to get coverage correctly and it is published for all submodules of my project, but pictures are not appearing (neither in Index.html file generated by Jacoco nor in VSTS board). See screenshot.

Have you encounter this kind of problem? How can I fix this please?

Thank you!

Task added in VSTS pipeline:

  # 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 configuration for aggregator module:

     <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>

POM for Maven parent module:

     <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>

For each submodule, below POM configuration:

     <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>
like image 413
Omar.R Avatar asked Sep 16 '25 23:09

Omar.R


1 Answers

I figured out that it is due to VSTS restrictions for security consideration. Same issue was reported here: https://developercommunity.visualstudio.com/content/problem/363333/jacoco-css-and-resources-missing-after-publishcode.html

like image 69
Omar.R Avatar answered Sep 19 '25 07:09

Omar.R