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

mavenOpts attribute doesn't resolve credentials variables

XMLWordPrintable

      This doesn't work:

                withCredentials([string(credentialsId: 'mvnrepo-keystore-pass', variable: 'JENKINSPASS')]) {
                    withMaven( 
                      mavenOpts: '-Djavax.net.ssl.keyStore=effaced.p12    -Djavax.net.ssl.keyStoreType=pkcs12 -Djavax.net.ssl.keyStorePassword=${JENKINSPASS}',
                      mavenSettingsConfig: 'my-maven-settings') {
                      sh 'mvn help:effective-settings -U'
                  }
                }  

      This does work:

                withCredentials([string(credentialsId: 'mvnrepo-keystore-pass', variable: 'JENKINSPASS')]) {
                    withMaven( 
                      mavenSettingsConfig: 'my-maven-settings') {
                      sh 'MAVEN_OPTS="-Djavax.net.ssl.keyStore=effaced.p12  -Djavax.net.ssl.keyStoreType=pkcs12 -Djavax.net.ssl.keyStorePassword=${JENKINSPASS}" mvn help:effective-settings -U'
                  }
                }  

            Unassigned Unassigned
            jbochenski Jakub Bochenski
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: