I have work with maven for some time but I am not sure if it is always recommended to write the artifact id at the end of the group id although it is repetitive as maven coordinates would include the concatenation of the group id, the artifact id, and the version.
For example, givin a java project with package com.example.helloword
I always do:
<groupId>com.example.helloword</groupId>
<artifactId>hello-word</artifactID>
<version>0.0.1-SNAPSHOT</version>
It is there a case in which it is preferred not to put the artifact id in the group id, what come to my mind is if the project is a shared module. For instance, a utility module used with helloword
:
<groupId>com.example.helloword</groupId>
<artifactId>utilities</artifactID>
<version>0.0.1-SNAPSHOT</version>
Is it correct? or should I append also the artifact id to the group id?
You should not append the artifactId to the groupId. GroupIds are used to gather different, related artifacts. You do not create your own groupId for each and every artifact.
It is usually a good idea to begin the package names with the groupId. But package names can (and usually are) longer.