I have a open source maven project hosted on GitHub. Let's say the url is https://github.com/foo/bar.
Now I want to upload it to the Sonatype OSS Maven Repository. I checked that they have a strict rule on the groupId (https://central.sonatype.org/publish/requirements/coordinates/#supported-code-hosting-services-for-personal-groupid).
groupId will identify your project uniquely across all projects, so we need to enforce a naming schema. It has to follow the package name rules, what means that has to be at least as a domain name you control, and you can create as many subgroups as you want. eg. org.apache.maven, org.apache.commons A good way to determine the granularity of the groupId is to use the project structure. That is, if the current project is a multiple module project, it should append a new identifier to the parent's groupId. eg. org.apache.maven, org.apache.maven.plugins, org.apache.maven.reporting
The question is that for projects hosted on GitHub, what is the proper groupId?
As user generated website has domain foo.github.io, I have at least the following two options:
It is a popular choice to use a groupId with the hosting site in the name. Search on http://search.maven.org for
While it is better to use a domain that you really own, using the hosting site in the groupId is a sensible fall-back. You should try to make sure that you choose a name that is not associated with the hosting company itself (e.g. com.google) but with the hosting site (e.g. com.googlecode), so that it is clear you are a project on the site and not a project of the underlying company.