-
Bug
-
Resolution: Unresolved
-
Major
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
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.