Hi I want to know the practice on creating a parent pom. So
1.Parent pom
<groupId>my.code</groupId>
<artifactId>project</artifactId>
<version>0.0.1-SNAPSHOT</version>
then child
<parent>
<groupId>my.code</groupId>
<artifactId>project</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>my.code.project</groupId>
<artifactId>child-A</artifactId>
or
2.Parent pom
<groupId>my.code.project</groupId>
<artifactId>project-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
then child
<parent>
<groupId>my.code.project</groupId>
<artifactId>project-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>child-A</artifactId>
Any reason behind one or the other? Or just a personal taste? Thank you
Either one would work, although I use the groupId to refer to the company or organization owning the artifact. Since the company owning the parent artifact usually owns the child artifact, I'd expect to see the same groupId between parent and child poms. For that reason I would use the second structure.
Usually if you have only a single level of folder structure like this:
+-- root (pom.xml)
+--- mod1 (pom.xml)
+--- mod2 (pom.xml)
+--- mod3 (pom.xml)
I would suggest to use only the same groupId like com.company.project. But if you a multi level structure like this:
+-- root (pom.xml)
+--- mod1 (pom.xml)
! +-- mod11 (pom.xml)
! +-- mod12 (pom.xml)
+--- mod2 (pom.xml)
! +-- mod21 (pom.xml)
! +-- mod22 (pom.xml)
+--- mod3 (pom.xml)
The root groupId i would suggest com.company.project. Than i would use different groupId in mod1 like com.company.project.part1 etc. and in mod2 com.company.project.part3 etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With