0

I am trying to migrate my existing code base from ant to maven. There are about 45 odd projects, which are built and compiling fine now on their own. I just need to know how do I collate them all together in one parent project. I have a few more questions but they are unrelated to this. So I was reading some tutorials on reactors in maven. But could not find any that were quite in detail or related to my situation.

My questions is 1: Do I have to all the projects under the <modules> section the parent pom. And add the parent project tag <parent> in all the child poms?

No.2 is: If the above step is right, then, if I change the version of the parent project from lets say 0.0.1-SNAPSHOT to 0.0.2-SNAPSHOT, do I have to go in and manually change all the child poms that have the parent pom declared in them? Is there an easier way to propagate the parent change into the child poms?

And No. 3 is: What is the use of <dependencyManagement> and <pluginManagement> in the parent pom. The maven website states that:

Note that only "instantiated" references are used - dependencyManagement and pluginManagement elements do not cause a change to the reactor sort order

Without much explanation. I know what instantiating in java is. But what does it mean in Maven?

Some examples would be nice. Thanks in advance.

hell_storm2004
  • 1,401
  • 2
  • 33
  • 66
  • 1
    The idea behind the "management" sections is that you can specify the version in the parent pom's "management" section, and then reference it by groupId and artifactId (no version) in all the child poms. That way, when you want to update to a newer version of a dependency/plugin, you change it in the parent and it automatically propagates to the children. Note that it is not just "version" that can be managed centrally, but all aspects of the default configuration of that artifact. – Rob Jul 15 '19 at 21:57
  • @Rob Thanks for the info. That was helpful. – hell_storm2004 Jul 23 '19 at 18:48

0 Answers0