Status: Open (View Workflow)
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.
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)?
Almost same issue, but two variables out of four are working correctly (no inclusions). Other two - not.
JACOCO_EXEC_FILES_PATH is always changed to its value in in the JaCoCo configuration
And both JACOCO_CLASS_FILES_PATH and JACOCO_SOURCE_FILES_PATH variables are parsed as strings:
[JaCoCo plugin] **/jacoco.exec;$JACOCO_CLASS_FILES_PATH;$JACOCO_SOURCE_FILES_PATH; locations are configured
[JaCoCo plugin] Number of found exec files for pattern **/jacoco.exec: ...
[JaCoCo plugin] Saving matched class directories for class-pattern: $JACOCO_CLASS_FILES_PATH:
[JaCoCo plugin] Saving matched source directories for source-pattern: $JACOCO_SOURCE_FILES_PATH:
[JaCoCo plugin] inclusions: 
[JaCoCo plugin] exclusions: [**/Test.class]
So, here's the pull request for the functionality:
I've run into the same issue described by Pawan and Arsenii. Why hasn't the PR been merged yet?
Because this is open source and there is nobody paid here. So if you need this to be accelerated you need to step in yourself and apply on the jenkins-mailing-list to get rights to contribute the plugin.
Almost same issue , jacoco plugin 3.0.4 also does not read value from parameterized build
Inclusions，Exclusions is available ,but the others is not .
Can we also get the thresholds to read from the environment variables? That would allow us to manage all of our thresholds per repository in a properties file, and have an earlier step that reads the properties file and set the threshold.
The use cases are similar, but let me know if you would like a separate ticket for this.