Packaging jar is invalid Aggregator project need pom as packaging


Question

My project has different modules.

  • Each module has a pom.xml which specifies jar packaging.
  • Each pom refers to common parent.
  • In the parent module there is also a pom.xml which includes all the modules.

When I tried to package using the pom.xml of the parent module, it shows the error - "Packaging jar is invalid Aggregator project need pom as packaging".

What can I do to make an executable jar of the application from maven?

1
32
11/6/2018 8:19:44 PM

To make things short: if your parent-aggregator project don't contains source code (and it's a good practice), just add this to your parent pom.xml:

<packaging>pom</packaging>

If the parent project contains source code, I strongly suggest you to:

  • move this code in a new module (let's call it commons)
  • make commons a child module of your parent project
  • add the commons module as a dependency of all other modules requiring it (maybe all of them)
  • add <packaging>pom</packaging> in the parent pom.xml
45
9/11/2013 7:52:59 AM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon