I am new to maven and I'm confused about the difference between the artifactId
and name
.
What I know is that artifactId
is the name of the artifact you are creating. I know that artifactId
together with the groupId
is use to uniquely identifies an artifact. So what is <name>
purpose in POM. like the pom below I got from a site there is an artifactId
and at the same time a <name>
.
<groupId>org.sonatype.mavenbook.multi</groupId> <artifactId>simple-parent</artifactId> <packaging>pom</packaging> <version>1.0</version> <name>Multi Chapter Simple Parent Project</name>
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.
The groupId is an XML element in the POM. XML file of a Maven project that specifies the id of the project group. In contrast, artifactId is an XML element in the POM. XML of a Maven project that specifies the id of the project (artifact).
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.
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. Show activity on this post. groupId uniquely identifies your project across all projects. artifactId is the name of the jar without version.
You are correct that the artifactId
helps identify the project.
The name
is simply a human-readable "friendly" name. It is not required for a basic setup.
From the Maven documentation,
artifactId: The artifactId is generally the name that the project is known by. Although the groupId is important, people within the group will rarely mention the groupId in discussion ... It, along with the groupId, create a key that separates this project from every other project in the world (at least, it should :) ). Along with the groupId, the artifactId fully defines the artifact's living quarters within the repository.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With