withMaven fails to create mvn wrapper in DinD context

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      I am trying to launch a maven container from an docker cloud agent.

      The withMaven instruction failed to get MAVEN_HOME, M2_HOME env variables and which mvn command.

      The consequence is that the mvn wrapper is not created in the MVN_CMD_DIR and so the globalSettings not injected when build with mvn command...

       

      node("my-jenkinsagent-alpine") { // Linux alpine agent with the Docker daemon and jdk8
          sh "docker version"
          docker.image('maven').inside { // Docker image with Maven installed
              withMaven(globalMavenSettingsConfig: 'default-maven-settings') {
                  git 'https://github.com/cyrille-leclerc/my-jar.git'
                  sh 'ls -al ${MVN_CMD_DIR}'
                  sh 'export PATH=$MVN_CMD_DIR:$PATH && mvn clean deploy'
              }
          }
      }
      

      build.log

            Assignee:
            Unassigned
            Reporter:
            Cyril Pottiers
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: