-
Bug
-
Resolution: Fixed
-
Minor
-
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
[JENKINS-56232] Maven Local Repository is always seen as relative when it should be absolute
Description |
Original:
Using Jenkinsfile with withMaven(mavenLocalRepo: '${user.home}/.m2/$EXECUTOR_NUMBER/repository') resolves the local repository path to {code:java} -Dmaven.repo.local=/home/jenkins/workspace/somerepository/${user.home}/.m2/2/repository: bad substitution {code} 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 {code:java} -Dmaven.repo.local=/home/jenkins/workspace/somerepository/~/.m2/2/repository: bad substitution {code} 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 |
New:
Using Jenkinsfile with withMaven(mavenLocalRepo: '${user.home}/.m2/$EXECUTOR_NUMBER/repository') resolves the local repository path to {code:java} -Dmaven.repo.local=/home/jenkins/workspace/somerepository/${user.home}/.m2/2/repository: bad substitution {code} 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 {code:java} -Dmaven.repo.local=/home/jenkins/workspace/somerepository/~/.m2/2/repository {code} 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 |
Assignee | Original: Alvaro Lobato [ alobato ] | New: Cyrille Le Clerc [ cleclerc ] |
Status | Original: Open [ 1 ] | New: In Progress [ 3 ] |
Status | Original: In Progress [ 3 ] | New: In Review [ 10005 ] |
Resolution | New: Fixed [ 1 ] | |
Status | Original: In Review [ 10005 ] | New: Closed [ 6 ] |
The related commit is here: https://github.com/jenkinsci/pipeline-maven-plugin/commit/496eb784e2e9a0fd9e463922f6001848c2d5eda6