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)?
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
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
- groupId uniquely identifies your project across all projects.
- artifactId is the name of the jar without version.
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
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)
© 2022 - 2024 — McMap. All rights reserved.