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

Jacoco plugin does not read values from environment variables

XMLWordPrintable

      We have a requirement to pass the Jacoco plugin parameters during Jenkins Job execution so we are following the below setup.
      We are injecting the environment variable as below in build step in Jenkins job and using the same variables in Jacoco plugin (PFA screenshot) in post build action.

      pathToExecFiles="**/jacoco.exec"
      pathToClassDirectories="**/target/classes/main"
      pathToSourceDirectories="**/src/main/java"
      inclusions="*/.class"
      exclusions="**/Test.class"

      However the Jacoco plugin is not substituting the env variable as the same is working for other plugins (JUnit/testNG).

      The build is failing with below error.

      [JaCoCo plugin] Collecting JaCoCo coverage data...
      [JaCoCo plugin] $pathToExecFiles;$pathToClassDirectories;$pathToSourceDirectories; locations are configured
      [JaCoCo plugin] Number of found exec files for pattern $pathToExecFiles: 0
      [JaCoCo plugin] Saving matched execfiles:
      [JaCoCo plugin] Saving matched class directories for class-pattern: $pathToClassDirectories:
      [JaCoCo plugin] Saving matched source directories for source-pattern: $pathToSourceDirectories:
      [JaCoCo plugin] Loading inclusions files..
      [JaCoCo plugin] inclusions: [$inclusions]
      [JaCoCo plugin] exclusions: [$exclusions]
      ERROR: Build step failed with exception
      java.lang.IllegalStateException: basedir /app/jenkins/jobs/xxxxxx/builds/1/jacoco/classes does not exist

      Can you enable the Jacoco to read the env variable (if exist)?

      Thanks.
      Pawan

            ognjenb Ognjen Bubalo
            pawanonline85 Pawan Gupta
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: