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

non standard jacoco usage breaks the build / standard dev flow

XMLWordPrintable

      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]
      

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

              Created:
              Updated:
              Resolved: