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

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

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: pipeline-maven-plugin
    • Labels:
      None
    • Environment:
      Pipeline Maven Integration Plugin 3.6.7
    • Similar Issues:

      Description

      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

        Attachments

          Activity

          Show
          lasselindqvist Lasse Lindqvist added a comment - The related commit is here: https://github.com/jenkinsci/pipeline-maven-plugin/commit/496eb784e2e9a0fd9e463922f6001848c2d5eda6
          Hide
          cleclerc Cyrille Le Clerc added a comment -

          Fixed in 3.6.10

          Show
          cleclerc Cyrille Le Clerc added a comment - Fixed in 3.6.10

            People

            • Assignee:
              cleclerc Cyrille Le Clerc
              Reporter:
              lasselindqvist Lasse Lindqvist
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: