I'm currently in the process of moving some project from Ant to Maven. Conformist as I am, I want to use well-established conventions for finding groupId
and artifactId
, but I can't find any detailed conventions (there are some, but they don't cover the points I'm wondering about).
Take this project for instance, first the Java package: com.mycompany.teatimer
Tea timer is actually two words, but the Java package naming conventions forbid the insertion of underscores or hyphens, so I'm writing it all together.
I chose the groupId
identical to the package ID because I think that's a good idea. Is it?
Finally, I have to pick an artifactId
, I currently went for teatimer
. But when I look at other Maven projects, they use hyphens to split words in artifactId
s, like this: tea-timer
. But it does look weird when concatenated to the groupId
: com.mycompany.teatimer.tea-timer
.
How would you do this?
Another example:
Package name: com.mycompany.awesomeinhouseframework
groupId
: com.mycompany.awesomeinhouseframework
(?)
artifactId
: awesome-inhouse-framework
(?)
Your convention seems to be reasonable. If I were searching for your framework in the Maven repo, I would look for awesome-inhouse-framework-x.y.jar
in com.mycompany.awesomeinhouseframework
group directory. And I would find it there according to your convention.
Two simple rules work for me:
groupId
(since such are quite unique) with all the constrains regarding Java packages namesartifactId
(keeping in mind that it should be jar-name friendly i.e. not contain characters that maybe invalid for a file name or just look weird)