Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-54038

Jacoco creates multiple Coverage reports and Trends graphs

    Details

    • Similar Issues:

      Description

      After yesterday's upgrade of Jenkins from 2.140 to 2.146 and several plugins, to many to enumerate, our pipeline jobs now generates loads of jacoco Coverage reports and Trends graphs. The jobs can hardly be opened probably due to the amount of data to load and they take forever to build. What has happened? I'am building at the moment so I'll add relevant data from the log files if I find any suspicous printouts.   

      Very similar to this issue:

      http://jenkins-ci.361315.n4.nabble.com/jacoco-plugin-broken-after-update-of-Pipeline-Maven-Integration-plugin-td4948864.html 

        Attachments

          Issue Links

            Activity

            Hide
            brainsam Alexander Moiseenko added a comment -

            We faced the same problem after update from jacoco plugin 3.0.1 to 3.0.3, jenkins core 2.121.1

            Show
            brainsam Alexander Moiseenko added a comment - We faced the same problem after update from jacoco plugin 3.0.1 to 3.0.3, jenkins core 2.121.1
            Hide
            famod Falko Modler added a comment - - edited

            As per pipeline-maven 3.5.15+, multi module coverage reports are disabled:

            So instead of too many reports you get, well, none!

            I am not sure how to solve this. I suppose you must now either merge the exec files and feed this into jacoco-plugin explicitly or you have to generate your own report (via the maven plugin) which you then might be able to publish with HTML Publisher Plugin.
            Or "just" use SonarQube...

            Show
            famod Falko Modler added a comment - - edited As per pipeline-maven 3.5.15+, multi module coverage reports are disabled : https://issues.jenkins-ci.org/browse/JENKINS-54139?focusedCommentId=351853&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-351853 https://github.com/jenkinsci/pipeline-maven-plugin/commit/75ce8e28539151ac35615655deb15d860a963c83#diff-00c89ee459a797b514c25cf81fa61585R131 So instead of too many reports you get, well, none! I am not sure how to solve this. I suppose you must now either merge the exec files and feed this into jacoco-plugin explicitly or you have to generate your own report ( via the maven plugin ) which you then might be able to publish with HTML Publisher Plugin . Or "just" use SonarQube...
            Hide
            famod Falko Modler added a comment - - edited

            Update to my previous comment:

            The workaround for recent pipeline-maven versions is actually easier than I first thought:
            Don't rely on withMaven() to create your aggregated report, just add an explicit jacoco() invocation instead!
            This will automatically "merge" all the exec files to create one big report for everything.

            If you want to explicitly disable the jacoco report publishing via withMaven() (which doesn't work anyway for multiple modules) you have two options:

            • withMaven(publisherStrategy: 'EXPLICIT', options: [...]) (don't add jacocoPublisher() to options)
            • withMaven(options: [jacocoPublisher(disabled: true)],...)
            Show
            famod Falko Modler added a comment - - edited Update to my previous comment: The workaround for recent pipeline-maven versions is actually easier than I first thought: Don't rely on withMaven() to create your aggregated report, just add an explicit jacoco() invocation instead! This will automatically "merge" all the exec files to create one big report for everything. If you want to explicitly disable the jacoco report publishing via withMaven() (which doesn't work anyway for multiple modules) you have two options: withMaven(publisherStrategy: 'EXPLICIT', options: [...] ) (don't add jacocoPublisher() to options) withMaven(options: [jacocoPublisher(disabled: true)] ,...)
            Hide
            famod Falko Modler added a comment -

            This ticket should be closed as this is not happening anymore with pipeline-maven 3.5.15+ (see comments above).

            Show
            famod Falko Modler added a comment - This ticket should be closed as this is not happening anymore with pipeline-maven 3.5.15+ (see comments above).
            Hide
            cleclerc Cyrille Le Clerc added a comment -

            Falko Modler can you provide a sample of your fix invoking the `jacoco` step and disabling withMaven - jacoco integration?

            Show
            cleclerc Cyrille Le Clerc added a comment - Falko Modler can you provide a sample of your fix invoking the `jacoco` step and disabling withMaven - jacoco integration?
            Hide
            famod Falko Modler added a comment - - edited

            A very stripped down excerpt of my setup:

            somewhere in your stage
                withMaven(publisherStrategy: 'EXPLICIT', options: [junitPublisher()]) {
                    sh "mvn clean install -Pjacoco"
                }
            
            custom 'jacoco' maven profile
                    <profile>
                        <id>jacoco</id>
                        <build>
                            <plugins>
                                <plugin>
                                    <groupId>org.jacoco</groupId>
                                    <artifactId>jacoco-maven-plugin</artifactId>
                                    <executions>
                                        <execution>
                                            <id>prepare-agent</id>
                                            <goals>
                                                <goal>prepare-agent</goal>
                                            </goals>
                                            <configuration>
                                                <propertyName>jacoco.agent.argLine</propertyName>
                                            </configuration>
                                        </execution>
                                        <!-- no automatic report here -->
                                    </executions>
                                </plugin>
                                <plugin>
                                    <groupId>org.apache.maven.plugins</groupId>
                                    <artifactId>maven-surefire-plugin</artifactId>
                                    <configuration>
                                        <argLine>${jacoco.agent.argLine} ${surefire.argLine}</argLine>
                                    </configuration>
                                </plugin>
                            </plugins>
                        </build>
                    </profile>
            
            somewhere in your pipeline, e.g. in an 'always' post block
                post {
                    always {
                        jacoco(exclusionPattern: '**/test*/**/*.class,**/gen/**/*.class',
                               inclusionPattern: 'com/somecompany/someproject/**/*.class,com/somecompany/module/**/*.class')
                    }
                }
            

            The patterns are just an example.

            Show
            famod Falko Modler added a comment - - edited A very stripped down excerpt of my setup: somewhere in your stage withMaven(publisherStrategy: 'EXPLICIT', options: [junitPublisher()]) { sh "mvn clean install -Pjacoco" } custom 'jacoco' maven profile <profile> <id> jacoco </id> <build> <plugins> <plugin> <groupId> org.jacoco </groupId> <artifactId> jacoco-maven-plugin </artifactId> <executions> <execution> <id> prepare-agent </id> <goals> <goal> prepare-agent </goal> </goals> <configuration> <propertyName> jacoco.agent.argLine </propertyName> </configuration> </execution> <!-- no automatic report here --> </executions> </plugin> <plugin> <groupId> org.apache.maven.plugins </groupId> <artifactId> maven-surefire-plugin </artifactId> <configuration> <argLine> ${jacoco.agent.argLine} ${surefire.argLine} </argLine> </configuration> </plugin> </plugins> </build> </profile> somewhere in your pipeline, e.g. in an 'always' post block post { always { jacoco(exclusionPattern: '**/test*/**/*.class,**/gen/**/*.class', inclusionPattern: 'com/somecompany/someproject/**/*.class,com/somecompany/module/**/*.class') } } The patterns are just an example.
            Hide
            centic centic added a comment -

            As far as I read the comments this was solved elsewhere, so no change necessary in this plugin. Please reopen with some more information if you think otherwise.

            Show
            centic centic added a comment - As far as I read the comments this was solved elsewhere, so no change necessary in this plugin. Please reopen with some more information if you think otherwise.

              People

              • Assignee:
                ognjenb Ognjen Bubalo
                Reporter:
                kengra Kent Granström
              • Votes:
                6 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: