9

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 ?

3 Answers 3

22

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.

1
  • 1
    Thanks, I set the slave-service to run as a local user and the settings.xml under C:/users/myuser/.m2/ was finally picked up. Besides: With the default system user and no other settings the settings.xml under the maven installation folder is used.
    – Rob
    Apr 23, 2014 at 9:49
8

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 !

1

For me what got this to work was using the -Duser.home variable.

I did get this to work! However, instead of entering it into the MAVEN_OPTS, in the configure jenkins screens, I entered it as a JVM level variable to my web server.

For me I'm using glassfish on WinTell, instead of tomcat. Glassfish starts as a windows service. Basically entered:

JVM variable name: user.home JVM value: /data/maven-2.2/jenkins

Then, in this directory /data/maven-2.2/jenkins make sure you have a copy of a valid settings.xml with the proxy info entered correctly. Doing so allows me to isolate a separate settings.xml for my jenkins services builds v. logging on interactively.

Eric

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.