In my Maven setup, I have the following directory structure
.
|-- parent
| `-- pom.xml
|-- module1
| |-- src...
| `-- pom.xml
|-- more modules...
`-- pom.xml
Each module's pom has the parent/pom.xml
as a parent, to regroup general information (eg. distributionManagement
)
The root pom.xml is just to allow a one-click build & deploy of all modules, so it has packaging pom
and lists all modules.
When I call "deploy" on the root pom, all builds and deploys well, but at the very end, it fails for the root project itself (because it lacks a distributionManagement
element).
Why does Maven want to build and deploy that root pom? In my understanding, it's just some sort of shortcut to build all modules. There is really nothing to deploy or no project relevant data in it.
Can and should I try to avoid deployment of that pom?
Note: the workaround of adding a distributionManagement
to the root pom, or make the root pom itself inherit from the parent/pom.xml are solutions to the build problem - I'm now more interested to understand if this is really necessary and why.
If your root pom is nowhere in the ancestry of your functional modules (i.e. your parent does not have root as its parent), then you could skip deployment of the aggregator by setting the maven.deploy.skip
property to true
inside your root pom.
That way, deployment would be skipped for root (it would still be "built", however).
However, I would simply deploy it as well. Give it some meaningfull coordinates (we use something like com.mycorp.aggregator-only:xy-aggregator:0-SNAPHSHOT
). SNAPSHOT Version is important, because otherwise, your artifact repository would block repeated builds.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments