How to get parent POM when building child project (Maven)

I have 3 sibling projects that have a common parent that I'm managing with Maven. The projects share same parent which is one level up. The parent POM has no knowledge of any of the children it simply contains boilerplate, repo definitions and common plugins. Everything works fine until I try to put these on TeamCity. Here's how I do it now

  1. Create one configuration per branch
  2. Trigger independently of each other based on check-ins

And now comes the problem: since I have a parent POM one level above the project it's not getting pulled when the child code is checked out and the build quickly fails. I suppose I can create another build configuration just to pull the parent (which is of type POM) but is there a better way that I'm missing?

Also when I create a parent project - how do I check out pom.xml only since I do not want any nested directories? When I put the following checkout rules into the configuration:

I get the following exception:
jetbrains.buildServer.vcs.VcsException: Getting sources for checkout rule './pom.xml=>./pom.xml' failed with erorr: org.tmatesoft.svn.core.SVNException: svn: Cannot replace a directory from within
svn: REPORT of '/svn/!svn/vcc/default': 500 Internal Server Error

Comment actions Permalink


Unfortunately currently you can only specify directories in checkout rules, not files.

So, if you don't want to checkout the whole directory tree for each single project, I'm affraid the only appropriate solution would be moving your parent pom into a directory at the same level where your projects reside, say "parent".

Modify your parent pom reference from "../pom.xml" to "../parent/pom.xml".

Create a single VCS root pointing at the root path and share it between the three configurations.

For each configuration specify its own checkout rules like these:


where "sibling1" is the path to the root of a particular sibling project.
This tells TeamCity extract only these paths.

Now in the maven runner settings specify the path to the pom location as "sibling1/pom.xml"

Now it should work as you expected.

Comment actions Permalink

Thanks Sergey,

I arrived to the same solution yesterday - moving parent POM into parallel directory. After that it does not require any additional rules or settings since child refers to the parent not by path but by group and artifact IDs


Please sign in to leave a comment.