maven multi module project: is relativepath necessary?

4.9k Views Asked by At

I'm trying to link together a set of disjoint maven projects into a standard multi module project.

The interesting thing is that the modules are currently not arranged in a natural heirarchy. If I link together with a parent pom, then the reactor won't start up until I add relativePaths to the parent stanza in the child pom XML files.

If the GAV details are correct in the parent version vs the child, and the child modules are all linked in the parent pom - shouldn't this be enough?

in simple terms - for a non-standard directory structure, is the relativePath strictly necessary for a multi module maven project?

Thanks, Ace

1

There are 1 best solutions below

0
On

in simple terms - for a non-standard directory structure, is the relativePath strictly necessary for a multi module maven project?

The answer is: Yes!

If the parent is not yet installed in the local repository and if the directory structure is for example:

.
 |-- my-module
 |   `-- pom.xml
 `-- parent
     `-- pom.xml

The child modules cannot inherit the groupId / version of their parent POM without setting the <relativePath> element.

See http://maven.apache.org/guides/introduction/introduction-to-the-pom.html#Example_2