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)?
-
I tried to learn it by myself, but I have hard time understanding it. I watched videos, links, few answers in SO, nothing helped. So please help me. – sofs1 Aug 27 '16 at 21:14
-
2Possible duplicate of [Maven artifact and groupId naming](http://stackoverflow.com/questions/3724415/maven-artifact-and-groupid-naming) – Tunaki Aug 27 '16 at 21:20
-
It is one of the most common question asked in any software engineering interview. By this question, interviewer wants to know about your basic knowledge on Maven and pom.xml file. I find recently one nice blog post on it with real life example. Just sharing the link here. Hope it will help others. [Difference between groupId and artifactId in pom.xml](https://industechie.com/index.php/2020/11/26/what-is-the-difference-between-groupid-and-artifactid-in-maven/) – Aritra Nov 26 '20 at 20:11
5 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

- 6,400
- 6
- 32
- 53
-
2So lets say my company ABC decided to put my project in internet for public use, the artifactId:
, groupId:com.abc.www ? What happens if some one comes up with same name for artifact ID and groupId. There are some probability for that too. – sofs1 Aug 27 '16 at 21:19 -
@user3705478 Hm, interesting question. You can try to create a new project using the values for a well known one, and even add it as a dependency, to explore. For example, try "creating" the Apache Commons library: mvn archetype:generate -DgroupId=org.apache.commons -DartifactId=commons-collections4 -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false and then add the "real" commons library as a dependency. It appears to work fine. I'm not sure why there is not an occlusion, internally. – Jameson Aug 27 '16 at 21:28
-
When you say a"add it as a dependency" add it to central universal repository or to my local project? – sofs1 Aug 27 '16 at 21:29
-
@user3705478 As far as a central repository, you'd have to register your groupId with the provider, and that's likely where the enforcement happens. For example, if you use Open Source Software Repository Hosting, Sonatype requires you to complete a JIRA ticket with your requested groupId. – Jameson Aug 27 '16 at 21:36
-
@user3705478 Here's a whole video all about it, just found this: https://www.youtube.com/watch?v=P_3yo-oU1To&feature=youtu.be – Jameson Aug 27 '16 at 21:37
-
1Thank you very much for the link. Now I understood better. And I tried creating a second maven project with same artifact ID in my local machine and maven thrown an error. – sofs1 Aug 27 '16 at 22:05
-
the version tag, are the artifactId or groupId? or is the version of mix (artifactId+groupId)? – Hernaldo Gonzalez Mar 12 '20 at 13:13
-
"groupId will identify your project uniquely across all projects", where? Who prevents me from having a project with the same groupid and artefactid as another person in another part of the world? This is what is missing from this answer. – nbro Apr 10 '22 at 18:39
In case of newbie understanding. This Link describes the best understanding of project identifiers. If I narrow down to main topic then here is the point:
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
If you want to understand how these identifiers have impact on POM
you can visit

- 121
- 2
- 8
- groupId uniquely identifies your project across all projects.
- artifactId is the name of the jar without version.

- 373
- 2
- 13
The main difference between groupId and artifactId in Maven is that the groupId specifies the id of the project group while the artifactId specifies the id of the project.
It is required to use third party libraries when developing a project. The programmer can download and add these third-party libraries to the project, but it is difficult to update them later. Maven provides a solution to this issue. It helps to include all the dependencies required for the project. Moreover, the programmer can specify the required dependencies in the POM.XML file. It has the configuration information to build the project. Furthermore, this file consists of several XML elements, and two of them are groupId and artifactId. example groupId : com.test.java (similar to package name) artifactId : javaproject(project or module name)

- 19
- 1
- 4
In POM, or anywhere, an artifact has three things
- List item
- group id
- version
group id uniquely tells where it belongs, artifact id tells what it is and version tells what exact version of the artifact.
For example, androidx.activity:activity-compose:1.7.1
Syntax: groupid:atrifactid:version
This means for androidx.activity:activity-compose:1.7.1, androidx.activity is a group id, activity-compose is an artifact id, and 1.7.1 is version of artifact.
You can check this in google repo (url: https://maven.google.com/web/index.html?q=activity-compose#androidx.activity:activity-compose:1.7.1) screenshot below,
The link of actual artifact: https://dl.google.com/android/maven2/androidx/activity/activity-compose/1.7.1/activity-compose-1.7.1.aar

- 7,362
- 3
- 47
- 64