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

Maven Local Repository is always seen as relative when it should be absolute

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • pipeline-maven-plugin
    • None
    • Pipeline Maven Integration Plugin 3.6.7

      Using Jenkinsfile with

      withMaven(mavenLocalRepo: '${user.home}/.m2/$EXECUTOR_NUMBER/repository')

      resolves the local repository path to

      -Dmaven.repo.local=/home/jenkins/workspace/somerepository/${user.home}/.m2/2/repository: bad substitution
      

      so user.home does not get resolved. This is fine if not possible now. But also using

      withMaven(mavenLocalRepo: '~/.m2/$EXECUTOR_NUMBER/repository')
      resolves the local repository path to

      -Dmaven.repo.local=/home/jenkins/workspace/somerepository/~/.m2/2/repository
      

      Using
      withMaven(mavenLocalRepo: '$WORKSPACE/../../.m2/$EXECUTOR_NUMBER/repository')
      can be used to escape from a single non-permanent workspace to use a common local repository, but this is not ideal.

      Concerned code seems to be here:
      https://github.com/jenkinsci/pipeline-maven-plugin/blob/pipeline-maven-3.6.7/jenkins-plugin/src/main/java/org/jenkinsci/plugins/pipeline/maven/WithMavenStepExecution2.java#L662

            cleclerc Cyrille Le Clerc
            lasselindqvist Lasse Lindqvist
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: