Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between artifactId and groupId in pom.xml?

How would you explain it to a newbie web developer or programmer with some real world organization example (like say facebook company or Google company)?

like image 226
sofs1 Avatar asked Aug 27 '16 21:08

sofs1


People also ask

What is groupId and artifactId?

The groupId is a parameter indicating the group or individual that created a project, which is often a reversed company domain name. The artifactId is the base package name used in the project, and we use the standard archetype.

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.

Is groupId mandatory in POM XML?

POM ExampleAll POM files require the project element and three mandatory fields: groupId, artifactId, version. Projects notation in repository is groupId:artifactId:version.


1 Answers

From maven.apache.org, Naming Conventions:

artifactId is the name of the jar without version. If you created it then you can choose whatever name you want with lowercase letters and no strange symbols. If it's a third party jar you have to take the name of the jar as it's distributed. eg. maven, commons-math

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

like image 130
Jameson Avatar answered Oct 03 '22 14:10

Jameson