Create a maven project with parent's packaging war

3.4k Views Asked by At

I want to create a Maven project. I want it to have a parent project. The problem is that the parent project has a package in: war. I see an error :

Invalid packaging for parent POM  must be "pom" but is "war"

What should I do ?

1

There are 1 best solutions below

0
On

A parent project (packaging with type pom) is by definition a container of submodules. Only the submodules are allowed to be of specific packaging types (like war or jar). You use a parent project to aggregate common dependencies and build configurations.

I suggest that you put the code you want to reuse in a submodule of type jar and then add this submodule as a dependency of other projects you have (with packaing type war or jar).

You could read Chapter 6 of the book Maven by Example where it illustrates how to build a maven multi-module project.