4

I have a simple multi-project hierarchy:

root/
  pom.xml
  project-a
    pom.xml
    subproject-a.1
        pom.xml
    subproject-a.2
        pom.xml
  project-b
    pom.xml
    subproject-b.1
        pom.xml
    subproject-b.2
        pom.xml

If I build a project (say, subproject-b.1) from the command line, the project will build find. However, from Jenkins, the same project will fail with a:

[FATAL] Non-resolvable parent POM: Could not find artifact com.foo.bob:project-b:pom:1 in releases (http://xxxx.foo.com:9080/libs-release) and 'parent.relativePath' points at wrong local POM @ line 7, column 13

Neither the root nor the project-a/project-b modules, just the subprojects. I did look at: Hudson build fail: Non-resolvable parent POM and made sure that my parent's relativePath is set to:

<relativePath>../pom.xml</relativePath> 

Thoughts on what I need to add to my pom.xml in order for Maven to play well with Jenkins?

Community
  • 1
  • 1
Perry Hoekstra
  • 202
  • 2
  • 9
  • Do you have the set to your child projects in the parent pom.xml – JScoobyCed Feb 09 '12 at 16:50
  • At which stage did it fail? Is it possible it is not the build of subproject-b1 but the build of it's parent that fail? I am wondering if while trying to resolve parent relativePath from the subproject-b1 location, the root project would actually be ../../pom.xml (inside the project-b/pom.xml ) – JScoobyCed Feb 09 '12 at 17:01
  • In regards to question one, yes I do. The root pom.xml looks like this: ' project-a project-b' and in one of the parent pom.xm, it is: ' subproject-a.1 subproject-a.2'. It fails in the child project, the upper level projects are not buildable, I have parent pom.xml files to hold common material. In regards to your second question, it fails in the child/subproject files. In the child/subproject files, the relative path is set to the next immediate pom.xml. – Perry Hoekstra Feb 09 '12 at 19:21
  • What version control system are you using? With subversion for example, it is possible to check out only the subproject. If that is the case, the relative path does not make sense to Jenkins. – matsev Feb 09 '12 at 19:03
  • Yes, it is Subversion. So to use Jenkins, Subversion and parent pom.xml files, I would have to pull the entire source tree from root for each build? – Perry Hoekstra Feb 09 '12 at 19:23
  • Pulling the entire source tree will solve your problem, but there are also other [solutions](http://stackoverflow.com/a/5177194/303598). – matsev Feb 09 '12 at 20:19
  • Yes, I had looked at that question also. The issue is pushing the pom files into Artifactory and is not updated (scroll to the bottom to see the issue). – Perry Hoekstra Feb 10 '12 at 21:07

1 Answers1

3

I had the same problem - Windows 10 - after installing Jenkins on my box. I even had a separate job just to build the parent pom and push it into my local maven repo (or so I thought). Turns out my jenkins service was setup to use the local system account which was pushing artifacts to a repo in my system folder and not the normal local maven repo in user.m2\repository.

To fix:

  • go to Control Panel -> Administrative Tools -> Services
  • right-click the Jenkins service and select Properties
  • on the Log On tab select 'This account' and enter the user and password you normally use to sign in to your box
  • click OK and restart the Jenkins service
Russ Jackson
  • 1,993
  • 1
  • 18
  • 14