Issue I have a Folder "Folder Test". Inside that folder I have a Pipeline job. I am using the config file provider to pass on maven settings to to my maven command. I use the Variable option to pass them as Environment Variable. My build fails as it cannot find the file provided. The location of the settings file is truncated:
[ERROR] Error executing Maven.
java.io.FileNotFoundException: The specified user settings file does not exist: /tmp/osx-slave-1/workspace/Folder
at org.apache.maven.cli.configuration.SettingsXmlConfigurationProcessor.process(SettingsXmlConfigurationProcessor.java:91)
at org.apache.maven.cli.MavenCli.configure(MavenCli.java:1017)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:283)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
More Information In the console logs, we can see that the space is encoded with %20. However when I echo the value of my environment variable, I can see it contains the space:
[Pipeline] wrap
provisoning config files...
copy managed file [MyGlobalSettings] to file:/tmp/osx-slave-1/workspace/Folder%20Test/test-bitbucket-team-project/test-space/master@tmp/config1407003690735796100tmp
[Pipeline] {
[Pipeline] sh
[master] Running shell script
+ echo /tmp/osx-slave-1/workspace/Folder Test/test-bitbucket-team-project/test-space/master@tmp/config1407003690735796100tmp
/tmp/osx-slave-1/workspace/Folder Test/test-bitbucket-team-project/test-space/master@tmp/config1407003690735796100tmp
[Pipeline] tool
[Pipeline] sh
[master] Running shell script
+ /usr/local/Cellar/maven/3.3.9/libexec/bin/mvn clean install -X -Dmaven.test.skip=true --settings /tmp/osx-slave-1/workspace/Folder Test/test-bitbucket-team-project/test-space/master@tmp/config1407003690735796100tmp
I reproduce with Pipeline and a Freestyle job as well:
[...]
copy managed file [MyGlobalSettings] to file:/tmp/je-1-home/workspace/Folder%20Test/test-junit@tmp/config297328061101523050tmp
[test-junit] $ mvn -Dmaven.test.failure.ignore=true clean install --settings /tmp/je-1-home/workspace/Folder Test/test-junit@tmp/config297328061101523050tmp
[ERROR] Error executing Maven.
[ERROR] The specified user settings file does not exist: /tmp/je-1-home/workspace/Folder
[...]
How to Reproduce
- Create a global maven config file `global-settings`
- Create a pipeline to run a Maven project with the following Jenkinsfile:
node {
stage 'Checkout'
checkout scm
stage 'Build Maven'
wrap([$class: 'ConfigFileBuildWrapper', managedFiles: [[fileId: 'global-settings', targetLocation: '', variable: 'GLOBAL_SETTINGS']]]) {
sh "echo {env.GLOBAL_SETTINGS}"
sh "${tool 'mvn'}/bin/mvn clean install --settings ${env.GLOBAL_SETTINGS}"
}
}
|