How to tell Jenkins to provide settings.xml to Maven?

8,687 views
Skip to first unread message

ka...@quipsy.de

unread,
Mar 5, 2014, 10:21:18 AM3/5/14
to jenkins...@googlegroups.com
I have configured the Config File plugin to provide a custom settings.xml.
But it seems the Jenkins slave is not using it.
How to tell Jenkins that the Maven installation it automatically pushes on the slave shall use that custom settings.xml file?
I thought Config File plugin would automatically do that "under the hood" (as it knows it is a Maven config file) but in fact it seems it does not.
Any help appreciated! :-)
-Markus

Christian Willman

unread,
Mar 6, 2014, 3:26:12 AM3/6/14
to jenkins...@googlegroups.com
Depends. Are you using a MavenBuild or a FreestyleBuild? The Config File Provider plugin will hook into a MavenBuild, but for a FreestyleBuild (using the "Invoke Maven Top-Level Targets" build step), you will need to enable the "Provide configuration files" Build Environment task and then modify the Maven command to include '-s ${SETTINGS_PATH}'.

If you are using this as a mechanism to push out settings.xml changes then it might be worthwhile to just provision out VMs using Puppet or Chef using your desired Maven configuration.

ka...@quipsy.de

unread,
Mar 6, 2014, 3:30:12 AM3/6/14
to jenkins...@googlegroups.com
It is a MavenBuilld, not a FreestyleBuild, that's why I am rather confused.

The MavenBuild correctly BUIILDSin fact, but is unable to publish to the repository ("unauthorized"), which is a proof that the "personal" settings.xml provided by the config plugin is NOT considered by that job option (at least).

ka...@quipsy.de

unread,
Mar 6, 2014, 6:20:16 AM3/6/14
to jenkins...@googlegroups.com
Updates Jenkins to latest LTS release, and updated config file provider to latest. The problem is still there:
The RedeployPublisher tells me it is using this file:

Maven RedeployPublisher use remote XXX maven settings from : C:\.jenkins\tools\hudson.tasks.Maven_MavenInstallation\Maven_3.0.4/conf/settings.xml

Looking into that file I see that it is a default Maven Config, but NOT the global or jenkins-specific settings.xml! So I think there is a bug in the config provider -- it apparently does not tell the RedeployPublisher that it must use both provided files (the global one and the local one) on a remote slave!

Can somebody confirm this?

Regards
-Markus

Am Donnerstag, 6. März 2014 09:26:12 UTC+1 schrieb Christian Willman:

ka...@quipsy.de

unread,
Mar 6, 2014, 9:42:31 AM3/6/14
to jenkins...@googlegroups.com
Ok I am a step further now and have it running, and I think I know what the problem is.
First of all, I confirm that "Use default maven global settings" is working very well and it effectively leads to using the configured global settings.xml provided by the Config File Provider plugin.
Also I confirm that the option "provided settings.xml" is working well and it effectievely leads to using the configured settings.xml provided by the Config File Provider plugin -- but that one has to be told in each and every Maven job description! :-(
What not work is "Use default maven settings". It leads to the fact that Jenkins still is using a "vanilly" Maven config instead of the settings.xml provided by the Config File Provider plugin. And it looks like this is a known "limitation" (I would say: "bug") of that plugin.

Am Donnerstag, 6. März 2014 09:26:12 UTC+1 schrieb Christian Willman:
Reply all
Reply to author
Forward
0 new messages