We are using declarative jenkins pipeline, We need to use a default compilation tools and versions (maven and java) for a particular stage in my pipeline instead of using which is defined globally in the pipeline. Which means:- One of my stage in the pipeline should not use the compilation tool which is configured globally.
"pipeline { agent { label "node-1" } tools { maven 'maven3.6.2' jdk 'jdk-17-linux' }"
One of my stage in the pipeline should not use the compilation tool which is configured globally.
You can follow the documentation on the Jenkinsfile Syntax and on the
toolsdirective in particular:And try the following example:
A better approach, however, would be to apply the same principle but use Docker containers as the build environments (container versions are just for example):