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

51,796

Solution 1

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

Solution 2

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

  1. Project Inheritance
  2. Project Aggregation
Share:
51,796
sofs1
Author by

sofs1

Updated on December 26, 2021

Comments

  • sofs1
    sofs1 over 2 years

    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)?