Q:

Which settings.xml is used by jenkins slave?

I have a Jenkins master (running on a small Linux box) and a Jenkins slave (running on a "correct" XP machine).
I have configured both for all jibs to be run on the Windows XP slave.
Unfortunatly, each time a build is run on that slave, the build fails due to the following error :
ERROR: Ignore Problem expanding maven opts macros org.jenkinsci.plugins.tokenmacro.TokenMacro
Found mavenVersion 3.0.3 from file jar:file:/E:/java-ext/apache-maven-3.0.3/lib/maven-core-3.0.3.jar!/META-INF/maven/org.apache.maven/maven-core/pom.properties
Parsing POMs
ERROR: Echec à la lecture des POMs
hudson.util.IOException2: remote file operation failed: C:\hudson\workspace\Autocat at hudson.remoting.Channel@ee5bc4:ndx-PC-winXP
    at hudson.FilePath.act(FilePath.java:752)
    at hudson.FilePath.act(FilePath.java:738)
    at hudson.maven.MavenModuleSetBuild$RunnerImpl.parsePoms(MavenModuleSetBuild.java:817)
    at hudson.maven.MavenModuleSetBuild$RunnerImpl.doRun(MavenModuleSetBuild.java:617)
    at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:429)
    at hudson.model.Run.run(Run.java:1374)
    at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:467)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:145)
Caused by: hudson.remoting.ProxyException: hudson.maven.MavenModuleSetBuild$MavenExecutionException: org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM: Failure to find fr.perigee.java:java-parent:pom:0.0.6 in http://tinkerpop.com/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of tinkerpop has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ line 3, column 10

I know this error is due to the bad definition of repository containing those artifacts, because used repository is defined in settings.xml. So, my question is quite simple : how can I define which settings.xml file is used by a Jenkins slave ?

A:

Maven uses a global settings and a user settings file. If the user settings file exists, it overrides the global one. 
The global one is found in %M2_HOME%\conf\, while the user one is in %HOME%\.m2\. Here %HOME% means the home directory of whatever user is running the Jenkins slave.
So the easiest solution, assuming it is possible in your situation, is to just copy the correct settings.xml file to the %HOME%\.m2\ directory on the Jenkins slave machine.
Alternatively, you can specify a custom settings.xml file on the mvn command line using the --settings option, so you could put the file in a known location (e.g. C:\) and then tell Jenkins to pass the setting to Maven, something like --settings C:\settings.xml.
As an aside, it's often useful to create a new Windows user to run the Jenkins slave, so that you can easily tell where it will search for configuration files.

A:

Like always, solution was simpler than I was thinking it could.
Jenkins slave is configured to be run by the System User.
As a consequence, for it to use my settings.xml, all I had to do was changing its associated user, and problem disappeared !

