| 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: bad substitution
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 |