Why use a parent pom file when creating an ear file?

I read this question on SO - How to add WAR inside EAR with Maven

In the top voted answer by "joelittlejohn" -

"Now create a parent module (with pom) and add the war and ear module to it. Make sure you have installed the parent of the war and ear modules. When you run the mvn package for this new parent, the war file will be built with the war and ear module ( containing war) will be created by the ear module. "

But why create a parent pom? Why not just create a standard maven project with just one pom. This single pom file contains dependencies and modules and then generates a .ear file from that one pom file?

Something like:






source to share

1 answer

In maven, it is typical to have a module for every war you want to build. And then the .ear file will contain multiple wars. Thus, having a module provides an easy separation of duties. The parent pom just wraps it all together.



All Articles