maven3 multi module child groupId
-
10-06-2021 - |
Question
In maven3, I get warnings if I specify the groupId of a child module in a multi-module project to be the same as the parent module. Now I'm not sure if this is indicating that I should use a different groupId or if I should omit it to use the parent groupId.
According to http://maven.apache.org/guides/mini/guide-naming-conventions.html
A good way to determine the granularity of the groupId is to use the project structure. That is, if the current project is a multiple module project, it should append a new identifier to the parent's groupId. eg. org.apache.maven, org.apache.maven.plugins, org.apache.maven.reporting
That leads me to believe that each child should have a different groupId than the parent. Is that correct?
La solution
From the maven documentation
If we want the groupId and / or the version of your modules to be the same as their parents, you can remove the groupId and / or the version identity of your module in its POM. This allows the module to inherit the groupId and / or the version of its parent POM.
The warning is to let the user know this and avoid situations like misspelling groupId
or versionId
.