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

non standard jacoco usage breaks the build / standard dev flow

      For some reason (not documented in the POM) blue ocean uses a the non preffered way of invoking jacoco for code coverage.

      http://www.eclemma.org/jacoco/trunk/doc/instrument-mojo.html

      Performs offline instrumentation. Note that after execution of test you must restore original classes with help of "restore-instrumented-classes" goal.

      The issue with this is that classess are not restored until prepare-package which is not called when running mvn test

      Thus when you run mvn test followed by mvn test you end up with a failure as jacoco tries to instrument already instrumented classes and bombs out. Workaround it to run mvn clean test but this adds to the turnaround time to check tests.

      Note you can just enable jacoco with mvn -Penable-jacoco with recent jenkins plugin poms and it does the right thing...

      ERROR] Failed to execute goal org.jacoco:jacoco-maven-plugin:0.7.9:instrument (default-instrument) on project blueocean-git-pipeline: Unable to instrument file.: Error while instrumenting class /mnt/c/workarea/source/github/jenkinsci/blueocean-plugin/blueocean-git-pipeline/target/classes/io/jenkins/blueocean/blueocean_git_pipeline/GitPipelineCreateRequest.class. Class io/jenkins/blueocean/blueocean_git_pipeline/GitPipelineCreateRequest is already instrumented. -> [Help 1]
      

          [JENKINS-45535] non standard jacoco usage breaks the build / standard dev flow

          James Dumay added a comment -

          vivek do you know why its setup this way?

          James Dumay added a comment - vivek do you know why its setup this way?

          Vivek Pandey added a comment - - edited

          Till PowerMock fixes https://github.com/powermock/powermock/issues/727 there is no way to use PowerMock and Jacoco on-the-fly documentation. For this reason we are using offline instrumentation and can't use Jenkins default Jacoco configuration.

          It's enabled by default, users who want to disable it can always do so with -Djacoco.skip=true.

          Vivek Pandey added a comment - - edited Till PowerMock fixes https://github.com/powermock/powermock/issues/727  there is no way to use PowerMock and Jacoco on-the-fly documentation . For this reason we are using offline instrumentation and can't use Jenkins default Jacoco configuration. It's enabled by default, users who want to disable it can always do so with -Djacoco.skip=true.

          Michael Neale added a comment -

          closing as there is a powermock/jacoco problem to resolve out of our control for now (and a way to work around). 

          Michael Neale added a comment - closing as there is a powermock/jacoco problem to resolve out of our control for now (and a way to work around). 

            vivek Vivek Pandey
            teilo James Nord
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: