2

What is the meaning of "com" at the beginning of (almost) all maven groupid's?

Should I do the same with my personal or internal company projects?

edit: Thanks to @Berger, I found the fitting question here on SO So this question could be marked as duplicate or be deleted. Thanks.

Sip
  • 373
  • 1
  • 6
  • 22
  • 1
    It's a convention to use the reverse of the domain name of your company as a basis for your groupId. So if you work for `example.com`, your groupId should probably be `com.example`, possibly with further keywords for grouping purposes if need be – Jeroen Steenbeeke Apr 20 '18 at 09:12
  • It is not quite a duplicate, the other question is about java package names. Sure Maven chose to follow the same convention, but your question may remain relevant as a question about Maven's `groupId` per se . – Arnaud Apr 20 '18 at 09:26

1 Answers1

3

From Maven's Naming Conventions :

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. Look at More information about package names(*). 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

(*) : Then from the Naming Conventions in Java for packages :

The prefix of a unique package name is always written in all-lowercase ASCII letters and should be one of the top-level domain names, currently com, edu, gov, mil, net, org, or one of the English two-letter codes identifying countries as specified in ISO Standard 3166, 1981.

Subsequent components of the package name vary according to an organization's own internal naming conventions. Such conventions might specify that certain directory name components be division, department, project, machine, or login names.

Also have a look at this question : Java packages com and org

Arnaud
  • 17,229
  • 3
  • 31
  • 44