Reputation: 11
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 ?
Upvotes: 1
Views: 3497
Reputation: 164
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.
Upvotes: 1