I note that in multibranch pipeline the workspace folder is cut.
For example a project named:
Sample09-Netbeans-MultiBranch-Pipeline-Maven-Svn
that comes from a subversion repository like
https://my-favourite-repo/svn/ProjectsJava/DevOps/Jenkins/Test/test-jenkins-java-maven-multibranch/
with a project folder like
D:ProjectsJavaDevOpsJenkinsTestest-jenkins-java-maven-multibranchrunkmyproject
produce a workspace folder like this
D:Jenkins.jenkinsworkspacepeline-Maven-Svn_trunk_myproject
other types of project whit similar names doesn't have this problem
I found a workaround adding
-a node definition
-a customWorkspace
but when i use it maven doesn't see
the settings.xml file and i must directly specify it in the maven command passing
a jenkins-global property.
No other action can provide it to the command (define a jenkins-config-file,
define it in jenkins-maven configuration or in project-maven configuration)
pipeline {
agent{
node{
label 'my-node'
customWorkspace "${JENKINS_HOME}/Workspace/${JOB_NAME}/${BUILD_NUMBER}"
}
}
stages {
stage('Build-And-Test') {
steps {
withMaven {
bat "mvn clean package test -B -s ${MAVEN_SETTINGS}"
}
}
}
}
}
Why Jenkins cut the folder name only in multibranch pipelines?
There is another way to define the workspace-job-folder-name outside of the jenkinsfile ?
OR
There is a way to let maven see the settings.xml configured in one of the Jenkins configuration?
question from:
https://stackoverflow.com/questions/65951843/jenkins-workspace-folder-cut-in-multibranch-pipeline 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…