Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

maven multi module project: is relativepath necessary?

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

like image 895
phatmanace Avatar asked Oct 02 '22 21:10

phatmanace


1 Answers

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

like image 62
Wahid Avatar answered Oct 05 '22 13:10

Wahid