1

I have to create multiple maven projects and am confused about what groupId I should use for one of the projects. Just to clarify, these projects are not dependent on each other.

We have domains like:
www.mycompany.com
subdomain1.mycompany.com
subdomain2.mycompany.com

It is easy to decide on groupId for the sub-projects as I can easily translate them from the URL. For example, com.mycompany.subdomain1 and com.mycompany.subdomain2

I am unable to decide on what should be the groupId for the main project(www.mycompany.com). I am new to the Maven world and have no idea what best practice should apply here. Is it ok to go with com.mycompany.www as groupId? If not, what are the other recommendations here?

Thank you!

ronnyfm
  • 1,973
  • 25
  • 31
  • Does this answer your question? [Maven artifact and groupId naming](https://stackoverflow.com/questions/3724415/maven-artifact-and-groupid-naming) – toniedzwiedz Aug 02 '22 at 06:11
  • @toniedzwiedz, yes I looked at that post but it's not helping. It says "...that has to be at least as a domain name you control", in my case if I directly translate the domain to groupId then it becomes "com.mycompany.www". Not sure using "www" is a good idea. And what should be the alternative in this kind of scenario? – user1684181 Aug 02 '22 at 15:27
  • They don't mean "www". By "domain name", they mean the name that is registered, which would be "mycompany.com". – Ellen Spertus Jun 25 '23 at 17:43

1 Answers1

0

As toniedzwiedz mentioned in a reply, Maven artifact and groupId naming this post must be the answer to your question. But then, since you mentioned it is a bit confusing, I will try to explain what I do normally, while creating projects.

You can read further here https://docs.oracle.com/javase/specs/jls/se6/html/packages.html#7.7

In your case, you can use com.mycompany as your parent package groupId.There is nothing wrong with having only two parts in it. There is no restriction in that regard as far as I know. Even you can have just one unique word as groupId. But to maintain the uniqueness and common standards, they enforce to follow the package naming conventions.