Can you use a variable in the withMaven command in pipeline. Example below:
withMaven(jdk: ‘jdk1.8.0_391’,
maven: ‘Maven_3.8.6’,
mavenLocalRepo: “blah”) {
blah blah blah
}
What I’d like is something like:
withMaven(jdk: ‘jdk1.8.0_$JDK_VERSION’
But that and ${env_JDK_VERSION} don’t seem to expand the JDK_VERSION parameter I am setting. I am sure I am missing something obvious, but hoping to be able to choose different JDK versions as a parameter and not have to change the withMaven syntax to accompany it.
Jenkins setup:
> Jenkins: 2.448 > OS: Windows Server 2016 - 10.0 > Java: 11.0.22 - Oracle Corporation (Java HotSpot(TM) 64-Bit Server VM) > --- > Office-365-Connector:4.21.0 > ace-editor:1.1 > analysis-model-api:12.1.0 > ansicolor:1.0.4 > ant:497.v94e7d9fffa_b_9 > antisamy-markup-formatter:162.v0e6ec0fcfcf6 > apache-httpcomponents-client-4-api:4.5.14-208.v438351942757 > authentication-tokens:1.53.v1c90fd9191a_b_ > authorize-project:1.7.1 > badge:1.9.1 > bootstrap4-api:4.6.0-6 > bootstrap5-api:5.3.3-1 > bouncycastle-api:2.30.1.77-225.v26ea_c9455fd9 > branch-api:2.1152.v6f101e97dd77 > build-blocker-plugin:1.7.9 > build-history-metrics-plugin:112.v476124de7dfc > build-metrics:1.3 > build-name-setter:2.4.1 > built-on-column:1.4 > caffeine-api:3.1.8-133.v17b_1ff2e0599 > checks-api:2.0.2 > cloudbees-folder:6.928.v7c780211d66e > command-launcher:107.v773860566e2e > commons-httpclient3-api:3.1-3 > commons-lang3-api:3.13.0-62.v7d18e55f51e2 > commons-text-api:1.11.0-95.v22a_d30ee5d36 > conditional-buildstep:1.4.3 > config-file-provider:968.ve1ca_eb_913f8c > content-replace:1.8.2 > convert-to-pipeline:1.0 > copyartifact:722.v0662a_9b_e22a_c > credentials:1337.v60b_d7b_c7b_c9f > credentials-binding:657.v2b_19db_7d6e6d > custom-checkbox-parameter:1.4 > data-tables-api:2.0.1-1 > disk-usage:1.2 > display-url-api:2.200.vb_9327d658781 > durable-task:550.v0930093c4b_a_6 > echarts-api:5.5.0-1 > editable-choice:71.v02a291ebbe45 > email-ext:2.105 > envinject:2.908.v66a_774b_31d93 > envinject-api:1.199.v3ce31253ed13 > extensible-choice-parameter:1.8.1 > external-monitor-job:215.v2e88e894db_f8 > flaky-test-handler:1.2.3 > flexible-publish:0.16.1 > font-awesome-api:6.5.1-3 > forensics-api:2.4.0 > git:5.2.1 > git-changelog:3.38 > git-client:4.7.0 > git-parameter:0.9.19 > git-server:114.v068a_c7cc2574 > github:1.38.0 > github-api:1.318-461.v7a_c09c9fa_d63 > github-pullrequest:0.7.0 > global-build-stats:293.vd7b_d6e361475 > global-pre-script:20.02 > greenballs:1.15.1 > groovy:457.v99900cb_85593 > groovy-postbuild:228.vcdb_cf7265066 > gson-api:2.10.1-15.v0d99f670e0a_7 > h2-api:11.1.4.199-12.v9f4244395f7a_ > handlebars:3.0.8 > http_request:1.18 > instance-identity:185.v303dc7c645f9 > ionicons-api:56.v1b_1c8c49374e > jackson2-api:2.16.2-378.v7e79818f53ce > jakarta-activation-api:2.1.3-1 > jakarta-mail-api:2.1.3-1 > javadoc:243.vb_b_503b_b_45537 > javax-activation-api:1.2.0-6 > javax-mail-api:1.6.2-9 > jaxb:2.3.9-1 > jdk-tool:73.vddf737284550 > jenkins-multijob-plugin:625.v3a_1ef0311fe7 > jgiven:0.15.1 > jnr-posix-api:3.1.19-1 > jobConfigHistory:1229.v3039470161a_d > joda-time-api:2.12.7-29.v5a_b_e3a_82269a_ > jquery:1.12.4-1 > jquery-detached:1.2.1 > jquery3-api:3.7.1-2 > jsch:0.2.16-86.v42e010d9484b_ > json-api:20240303-41.v94e11e6de726 > json-path-api:2.9.0-33.v2527142f2e1d > junit:1259.v65ffcef24a_88 > junit-attachments:205.vc0677977deb_0 > lockable-resources:1243.v346d600eea_24 > log-parser:2.3.3 > mailer:472.vf7c289a_4b_420 > matrix-auth:3.2.2 > matrix-project:822.824.v14451b_c0fd42 > maven-plugin:3.23 > metrics:4.2.21-449.v6960d7c54c69 > metrics-diskusage:3.0.0 > mina-sshd-api-common:2.12.0-90.v9f7fb_9fa_3d3b_ > mina-sshd-api-core:2.12.0-90.v9f7fb_9fa_3d3b_ > momentjs:1.1.1 > monitoring:1.98.0 > msbuild:1.30 > multibranch-build-strategy-extension:48.v3dc306525d0c > multiple-scms:0.8 > multiselect-parameter:1.7 > muuri-api:0.9.5-3 > nodelabelparameter:1.12.0 > nuget:1.1 > okhttp-api:4.11.0-172.vda_da_1feeb_c6e > pam-auth:1.10 > parameterized-scheduler:262.v00f3d90585cc > parameterized-trigger:787.v665fcf2a_830b_ > pipeline-build-step:540.vb_e8849e1a_b_d8 > pipeline-graph-analysis:216.vfd8b_ece330ca_ > pipeline-groovy-lib:704.vc58b_8890a_384 > pipeline-input-step:491.vb_07d21da_1a_fb_ > pipeline-maven:1381.v08b_63fa_30559 > pipeline-maven-api:1381.v08b_63fa_30559 > pipeline-milestone-step:111.v449306f708b_7 > pipeline-model-api:2.2183.vb_36481468374 > pipeline-model-definition:2.2183.vb_36481468374 > pipeline-model-extensions:2.2183.vb_36481468374 > pipeline-multibranch-defaults:2.1 > pipeline-rest-api:2.34 > pipeline-stage-step:305.ve96d0205c1c6 > pipeline-stage-tags-metadata:2.2183.vb_36481468374 > pipeline-stage-view:2.34 > pipeline-utility-steps:2.16.2 > plain-credentials:179.vc5cb_98f6db_38 > plugin-usage-plugin:4.2 > plugin-util-api:4.1.0 > popper-api:1.16.1-3 > popper2-api:2.11.6-4 > postbuild-task:1.9 > postbuildscript:3.2.0-550.v88192b_d3e922 > powershell:2.1 > preSCMbuildstep:71.v1f2990a_37e27 > prism-api:1.29.0-13 > pull-request-monitoring:335.v525cd64ec76b_ > role-strategy:711.vf33a_d2c994b_a_ > run-condition:1.7 > scm-api:683.vb_16722fb_b_80b_ > script-security:1326.vdb_c154de8669 > select2-api:4.0.13-8 > shared-objects:0.44 > skip-certificate-check:1.1 > snakeyaml-api:2.2-111.vc6598e30cc65 > ssh-credentials:322.v124df57ed808 > sshd:3.322.v159e91f6a_550 > structs:337.v1b_04ea_4df7c8 > timestamper:1.26 > token-macro:400.v35420b_922dcb_ > trilead-api:2.141.v284120fd0c46 > uno-choice:2.8.1 > variant:60.v7290fc0eb_b_cd > versioncolumn:243.vda_c20eea_a_8a_f > versionnumber:1.11 > view-job-filters:369.ve0513a_a_f5524 > warnings-ng:11.2.0 > windows-slaves:1.8.1 > workflow-aggregator:596.v8c21c963d92d > workflow-api:1291.v51fd2a_625da_7 > workflow-basic-steps:1049.v257a_e6b_30fb_d > workflow-cps:3883.vb_3ff2a_e3eea_f > workflow-durable-task-step:1331.vc8c2fed35334 > workflow-job:1400.v7fd111b_ec82f > workflow-multibranch:783.va_6eb_ef636fb_d > workflow-scm-step:415.v434365564324 > workflow-step-api:657.v03b_e8115821b_ > workflow-support:865.v43e78cc44e0d