1

I am designing a multi-module maven system along the lines recommended here (see answer by Carlspring) and here. The pattern is separating the parent from the aggregator.

This all works pretty well except for one thing. As I develop the parent module, I find that if the parent changes, I must rebuild it first before building my aggregate. Otherwise it will pull the parent from the repository, which will always be one revision behind.

Is there an easy way to force rebuilding of the parent and NOT relying on the repo? This seems like it will recur again and again as with bootstrap building.

UPDATE: someone asked for a directory layout. Perhaps this will help:

$ find . -name pom.xml
./pom.xml
./myappp008-cs/pom.xml
./myappp008-ds/pom.xml
./myappp008-gr/pom.xml
./myappp008-as/pom.xml
./myappp008-parent/pom.xml

The top level pom is the aggregator and the myapp008-parent pom is the parent.

Also, both of the two links I included show a directory layout similar to mine.

Community
  • 1
  • 1
Steve Cohen
  • 4,679
  • 9
  • 51
  • 89
  • The short answer is *no*. (I hope I'm not miss understanding the question). If you're building a multimodule project, you'll mostly start building from the top level (except in cases where you know it's safe to build only one child project). It might add some clarity if you add an image/ascii art of the layout of your project(s). – Augusto Jan 21 '16 at 17:32
  • hope this clarification helps. – Steve Cohen Jan 21 '16 at 17:43
  • 1
    Why are you putting your parent into a sibling folder and not to root of your project? – khmarbaise Jan 21 '16 at 17:49
  • Both of the links I mentioned explain why. There is advantage to separating the aggregation function from the inheritance function, and maven documentation recommends doing so. It makes all the poms simpler. But for this flaw. – Steve Cohen Jan 21 '16 at 18:00
  • Do you have the project somewhere online ? In a multi module build the parent contains the module references and usually also the dependencyManagement for the whole project....If you have defined the `` in your aggregator this means the parent will be solved from the repository and not from `myappp008-parent` which means your multi module build is not a real multi module build...This in consequence means your are violating separation of concerns...Apart from that are you using Maven 3.X ? Those references you gave are very old...and partially wrong in the meantime... – khmarbaise Jan 21 '16 at 18:28
  • I am using multimodule build perhaps differently than normal, to build a collection of rpms with a functional relationship to one another but usually to be deployed on different servers. Typically only one or two would even be java apps or share dependencies. Thanks, but my answer solved my problem very nicely. – Steve Cohen Jan 21 '16 at 18:50

1 Answers1

0

Duh, just making the parent the first module in the aggregator handles the case. Previously, I had not made the parent one of the modules at all.

Steve Cohen
  • 4,679
  • 9
  • 51
  • 89