Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

groupId of maven projects hosted on GitHub

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://docs.sonatype.org/display/Repository/Choosing+your+Coordinates).

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 groudId?

As user generated website has domain foo.github.io, I have at least the following two options:

  • com.github.foo
  • io.github.foo
like image 713
stderr Avatar asked Nov 12 '13 09:11

stderr


People also ask

What should be groupId in Maven project?

Maven uses a set of identifiers, also called coordinates, to uniquely identify a project and specify how the project artifact should be packaged: groupId – a unique base name of the company or group that created the project. artifactId – a unique name of the project. version – a version of the project.

What is groupId in Maven dependency?

groupId This element indicates the unique identifier of the organization or group that created the project. The groupId is one of the key identifiers of a project and is typically based on the fully qualified domain name of your organization. For example org. apache. maven.

How do I deploy a Maven project in GitHub?

You should see maven-deploy-plugin "upload" the files to your local staging repository in the target directory, then site-maven-plugin committing those files and pushing them to the server. Visit github.com in your browser, select the mvn-repo branch, and verify that all your binaries are now there. Congratulations!

What is the default repository for Maven?

Maven Central, a.k.a. the Central Repository, is the default repository for Maven, SBT, Leiningen, and many other JVM based build tools. It has been around since 2002, and serves many terabytes of assets every year. Maven Central also has a search site.


1 Answers

It is a popular choice to use a groupId with the hosting site in the name. Search on http://search.maven.org for

  • net.sf
  • sourceforge
  • googlecode
  • github

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.

like image 58
rec Avatar answered Sep 28 '22 07:09

rec