[JIRA] (JENKINS-57324) Error running maven with settings file when running multibranch pipeline with a slash in the branch

32 views
Skip to first unread message

mfj@earthling.net (JIRA)

unread,
May 3, 2019, 10:57:02 AM5/3/19
to jenkinsc...@googlegroups.com
Mario Jauvin created an issue
 
Jenkins / Bug JENKINS-57324
Error running maven with settings file when running multibranch pipeline with a slash in the branch
Issue Type: Bug Bug
Assignee: Dominik Bartholdi
Components: config-file-provider-plugin
Created: 2019-05-03 14:56
Environment: Confile File Provider ver 3.6
Jenkins ver 2.164.2
Windows 10
Priority: Major Major
Reporter: Mario Jauvin

I configured a maven settings and global settings file in the Pipeline Maven Configuration of the folder containing the multibranch pipeline job.  When I run the following stage from my Jenkins file:

stage('Package') {
steps {
withMaven() {
bat "set MAVEN&mvn ${env.MAVEN_VERBOSE} clean package ${env.RELEASE_VERSION_PARAMETERS}"
}

}
}

I get this error:

[ERROR] Error executing Maven. [ERROR] The specified user settings file does not exist: e:\cc-build\checkout\aws\dctl\branchespackageFspring-boot\workspace@tmp\withMaven22e2d518\settings.xml

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

mfj@earthling.net (JIRA)

unread,
May 3, 2019, 11:01:04 AM5/3/19
to jenkinsc...@googlegroups.com
Mario Jauvin updated an issue
Change By: Mario Jauvin
I configured a maven settings and global settings file in the Pipeline Maven Configuration of the folder containing the multibranch pipeline job.  When I run the following stage from my Jenkins file:
{quote}stage('Package') {
steps {
withMaven() {
bat "set MAVEN&mvn ${env.MAVEN_VERBOSE} clean package ${env.RELEASE_VERSION_PARAMETERS}"
}

}
}
{quote}
I get this error:
{quote}[ERROR] Error executing Maven. [ERROR] The specified user settings file does not exist:
e C :\ cc-build jenkins \ checkout\aws\ dctl\branchespackageFspring-boot\workspace@tmp\withMaven22e2d518\settings.xml

{quote}
The reason I get this error is that the folder containing the branch is called branches%2Fspring-boot and the config file provider is replacing %2 with package (I assume this is the second argument to the script that is invoked)

mfj@earthling.net (JIRA)

unread,
May 3, 2019, 11:03:02 AM5/3/19
to jenkinsc...@googlegroups.com

mfj@earthling.net (JIRA)

unread,
May 3, 2019, 11:04:03 AM5/3/19
to jenkinsc...@googlegroups.com
Mario Jauvin updated an issue
I configured a maven settings and global settings file in the Pipeline Maven Configuration of the folder containing the multibranch pipeline job.  When I run the following stage from my Jenkins file:
{quote}stage('Package') {
steps {
withMaven() {
bat " set MAVEN& mvn ${env.MAVEN_VERBOSE} clean package ${env.RELEASE_VERSION_PARAMETERS}"
}

}
}
{quote}
I get this error:
{quote}[ERROR] Error executing Maven. [ERROR] The specified user settings file does not exist: C:\jenkins\dctl\branchespackageFspring-boot\workspace@tmp\withMaven22e2d518\settings.xml

{quote}
The reason I get this error is that the folder containing the branch is called branches%2Fspring-boot and the config file provider is replacing %2 with package (I assume this is the second argument to the script that is invoked)

domi@fortysix.ch (JIRA)

unread,
May 6, 2019, 3:00:02 AM5/6/19
to jenkinsc...@googlegroups.com
Dominik Bartholdi commented on Bug JENKINS-57324
 
Re: Error running maven with settings file when running multibranch pipeline with a slash in the branch

can you please explain what are the values of ${env.MAVEN_VERBOSE} and ${env.RELEASE_VERSION_PARAMETERS}?

mfj@earthling.net (JIRA)

unread,
May 6, 2019, 7:53:02 PM5/6/19
to jenkinsc...@googlegroups.com

For all intents you can ignore the. I will remove them as they are not important to reproducing the problem.

mfj@earthling.net (JIRA)

unread,
May 7, 2019, 1:19:02 PM5/7/19
to jenkinsc...@googlegroups.com
Mario Jauvin updated an issue
Change By: Mario Jauvin
I configured a maven settings and global settings file in the Pipeline Maven Configuration of the folder containing the multibranch pipeline job.  When I run the following stage from my Jenkins file:
{quote}stage('Package') {
steps {
withMaven() {
bat "mvn ${env.MAVEN_VERBOSE} clean package ${env.RELEASE_VERSION_PARAMETERS} "
}

}
}
{quote}
I get this error:
{quote}[ERROR] Error executing Maven. [ERROR] The specified user settings file does not exist: C:\jenkins\dctl\branchespackageFspring-boot\workspace@tmp\withMaven22e2d518\settings.xml
{quote}
The reason I get this error is that the folder containing the branch is called branches%2Fspring-boot and the config file provider is replacing %2 with package (I assume this is the second argument to the script that is invoked)

mfj@earthling.net (JIRA)

unread,
May 7, 2019, 1:20:02 PM5/7/19
to jenkinsc...@googlegroups.com
Mario Jauvin edited a comment on Bug JENKINS-57324
For all intents you can ignore the. I will remove removed them as they are not important to reproducing the problem.

mfj@earthling.net (JIRA)

unread,
May 7, 2019, 2:16:02 PM5/7/19
to jenkinsc...@googlegroups.com
Mario Jauvin edited a comment on Bug JENKINS-57324
For all intents and purpose you can ignore the them . I removed them as they are not important to reproducing the problem.

mfj@earthling.net (JIRA)

unread,
May 7, 2019, 4:14:02 PM5/7/19
to jenkinsc...@googlegroups.com
Mario Jauvin updated an issue
Change By: Mario Jauvin
I configured a maven settings and global settings file in the Pipeline Maven Configuration of the folder containing the multibranch pipeline job.  When I run the following stage from my Jenkins file:
{quote}stage('Package') {
steps {
withMaven()
{
Unknown macro: \{ bat "mvn clean package"
}

}
}
{quote}
I get this error:
{quote}[ERROR] Error executing Maven. [ERROR] The specified user settings file does not exist: C:\jenkins\dctl\branchespackageFspring-boot\workspace@tmp\withMaven22e2d518\settings.xml
{quote}
The reason I get this error is that the folder containing the branch is called branches%2Fspring-boot and the config file provider is replacing %2 with package (I assume this is because package is the second argument to the script that is invoked)

mfj@earthling.net (JIRA)

unread,
May 13, 2019, 10:52:02 AM5/13/19
to jenkinsc...@googlegroups.com

mfj@earthling.net (JIRA)

unread,
May 13, 2019, 10:55:02 AM5/13/19
to jenkinsc...@googlegroups.com
Mario Jauvin updated an issue
I configured a maven settings and global settings file in the Pipeline Maven Configuration of the folder containing the multibranch pipeline job.  When I run the following stage from my Jenkins file:

{noformat}
stage('Package') {
steps {
  withMaven()  {
   bat "mvn clean package"
  }
}
}

{noformat}

I get this error:
{quote}[ERROR] Error executing Maven. [ERROR] The specified user settings file does not exist: C:\jenkins\dctl\branchespackageFspring-boot\workspace@tmp\withMaven22e2d518\settings.xml
{quote}
The reason I get this error is that the folder containing the branch is called branches%2Fspring-boot and the config file provider is replacing %2 with package (I assume this is because package is the second argument to the script that is invoked)

mfj@earthling.net (JIRA)

unread,
May 13, 2019, 10:56:02 AM5/13/19
to jenkinsc...@googlegroups.com
Mario Jauvin commented on Bug JENKINS-57324
 
Re: Error running maven with settings file when running multibranch pipeline with a slash in the branch

I reformatted the description was the quote was garbling the text.  Sorry.  Any idea on whether a fix could be found?

domi@fortysix.ch (JIRA)

unread,
May 13, 2019, 11:15:02 AM5/13/19
to jenkinsc...@googlegroups.com

Cyrille Le Clerc do you have any idea what could be causing this? If this is really caused by the config-file-provider, then I would suspect it here https://github.com/jenkinsci/config-file-provider-plugin/blob/master/src/main/java/org/jenkinsci/lib/configprovider/model/ConfigFileManager.java#L95-L101 - but to be hownest I have no idea why this should be the case and I have no way to test on windows...

mfj@earthling.net (JIRA)

unread,
May 13, 2019, 12:04:01 PM5/13/19
to jenkinsc...@googlegroups.com

Dominik Bartholdi I can help troubleshoot this if you want.  I have a question.  How does config file plugin provide the maven command line option (-s for settings file) to the maven command?

I suspect that the problem may be in the pipeline-maven-plugin where in windows the % is not properly escaped when invoking the maven command.

cleclerc@cloudbees.com (JIRA)

unread,
May 13, 2019, 1:36:02 PM5/13/19
to jenkinsc...@googlegroups.com

cleclerc@cloudbees.com (JIRA)

unread,
May 13, 2019, 1:36:02 PM5/13/19
to jenkinsc...@googlegroups.com
Cyrille Le Clerc commented on Bug JENKINS-57324
 
Re: Error running maven with settings file when running multibranch pipeline with a slash in the branch

Mario Jauvin could you please enable the Jenkins logs on the logger "org.jenkinsci.plugins.pipeline.maven.WithMavenStepExecution2" to "FINER" and re run the build please?
Troubleshooting message will be added in the console of your build.

Reference: https://github.com/jenkinsci/pipeline-maven-plugin/blob/pipeline-maven-3.6.12/jenkins-plugin/src/main/java/org/jenkinsci/plugins/pipeline/maven/WithMavenStepExecution2.java#L684

cleclerc@cloudbees.com (JIRA)

unread,
May 13, 2019, 1:36:03 PM5/13/19
to jenkinsc...@googlegroups.com

cleclerc@cloudbees.com (JIRA)

unread,
May 13, 2019, 1:37:03 PM5/13/19
to jenkinsc...@googlegroups.com
Cyrille Le Clerc edited a comment on Bug JENKINS-57324
 
Re: Error running maven with settings file when running multibranch pipeline with a slash in the branch
[~marioja] could you please enable the Jenkins logs on the logger "org.jenkinsci.plugins.pipeline.maven.WithMavenStepExecution2" to "FINER" and re run the build please?


[~domi] I'm assigning the ticket to me

mfj@earthling.net (JIRA)

unread,
May 13, 2019, 3:10:02 PM5/13/19
to jenkinsc...@googlegroups.com

I did and the problem is that when the with maven wrapper script is created, the pathnames contain %2F which when invoked inside the wrapper scripts get evaluated as arguments.  Here is the log output from WithMavenStepExecution2:

 

Generated Maven wrapper script: 
@echo off
echo ----- withMaven Wrapper script -----
"C:\APPS\apache-maven-3.6.0\bin\mvn.cmd" --batch-mode --show-version --settings "e:\cc-build\checkout\abc\citest\branches%2Ftest\workspace@tmp\withMaven94865076\settings.xml" --global-settings "e:\cc-build\checkout\abc\citest\branches%2Ftest\workspace@tmp\withMaven94865076\globalSettings.xml"  %*

when calling maven in that manner, it will not work.  The generated wrapper script should double the % signs in each path argument.  For example:

 

 

@echo off
echo ----- withMaven Wrapper script -----
"C:\APPS\apache-maven-3.6.0\bin\mvn.cmd" --batch-mode --show-version --settings "e:\cc-build\checkout\aws\citest\branches%%2Ftest\workspace@tmp\withMaven94865076\settings.xml" --global-settings "e:\cc-build\checkout\aws\citest\branches%%2Ftest\workspace@tmp\withMaven94865076\globalSettings.xml"  %*

 

mfj@earthling.net (JIRA)

unread,
May 13, 2019, 3:12:02 PM5/13/19
to jenkinsc...@googlegroups.com
Mario Jauvin edited a comment on Bug JENKINS-57324
I did and the problem is that when the with maven wrapper script is created, the pathnames contain %2F which when invoked inside the wrapper scripts get evaluated as arguments.  Here is the log output from WithMavenStepExecution2:

 
{noformat}

Generated Maven wrapper script:
@echo off
echo ----- withMaven Wrapper script -----
"C:\APPS\apache-maven-3.6.0\bin\mvn.cmd" --batch-mode --show-version --settings "e:\cc-build\checkout\abc\citest\branches%2Ftest\workspace@tmp\withMaven94865076\settings.xml" --global-settings "e:\cc-build\checkout\abc\citest\branches%2Ftest\workspace@tmp\withMaven94865076\globalSettings.xml"  %*
{noformat}

when calling maven in that manner, it will not work.  The generated wrapper script should double the % signs in each path argument.  For example:

 

 
{noformat}

@echo off
echo ----- withMaven Wrapper script -----
"C:\APPS\apache-maven-3.6.0\bin\mvn.cmd" --batch-mode --show-version --settings "e:\cc-build\checkout\aws\citest\branches%%2Ftest\workspace@tmp\withMaven94865076\settings.xml" --global-settings "e:\cc-build\checkout\aws\citest\branches%%2Ftest\workspace@tmp\withMaven94865076\globalSettings.xml"  %*
{noformat}
 
I tested modifying the withMaven wrapper script manually and it works.

mfj@earthling.net (JIRA)

unread,
May 13, 2019, 3:36:02 PM5/13/19
to jenkinsc...@googlegroups.com

From what I understand the code, the method setupMaven which defines and overrides the MAVEN_CONFIG environment variable is not Windows specific so that making the change in that method would require knowing the platform.

cleclerc@cloudbees.com (JIRA)

unread,
May 14, 2019, 8:51:03 AM5/14/19
to jenkinsc...@googlegroups.com
Cyrille Le Clerc started work on Bug JENKINS-57324
 
Change By: Cyrille Le Clerc
Status: Open In Progress

cleclerc@cloudbees.com (JIRA)

unread,
May 14, 2019, 8:51:03 AM5/14/19
to jenkinsc...@googlegroups.com

cleclerc@cloudbees.com (JIRA)

unread,
May 14, 2019, 11:32:02 AM5/14/19
to jenkinsc...@googlegroups.com

cleclerc@cloudbees.com (JIRA)

unread,
May 14, 2019, 11:32:03 AM5/14/19
to jenkinsc...@googlegroups.com

mfj@earthling.net (JIRA)

unread,
May 14, 2019, 1:26:03 PM5/14/19
to jenkinsc...@googlegroups.com

cleclerc@cloudbees.com (JIRA)

unread,
May 16, 2019, 3:57:01 PM5/16/19
to jenkinsc...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages