Is the parent pom created under the same group of its children or under its own / parent?

Hi, I want to know the practice of 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 for this or that? Or just a personal taste? Thanks you

+3
source share
2 answers

Either one will work, although I use groupId to refer to the company or organization that owns the artifact. Since the company that owns the maternal artifact usually owns the artifact of the child, I expect to see the same ID group between the parent and daughter children. For this reason, I would use a second structure.

+3
source

, , :

 +-- root (pom.xml)
      +--- mod1 (pom.xml)
      +--- mod2 (pom.xml)
      +--- mod3 (pom.xml)

, com.company.project. :

 +-- root (pom.xml)
      +--- mod1 (pom.xml)
      !      +-- mod11 (pom.xml)
      !      +-- mod12 (pom.xml)
      +--- mod2 (pom.xml)
      !      +-- mod21 (pom.xml)
      !      +-- mod22 (pom.xml)
      +--- mod3 (pom.xml)

Id com.company.project. groupId mod1, com.company.project.part1 .., mod2 com.company.project.part3 ..

+3

All Articles