What is the Difference between groupId and artifactId in Maven

The main difference between the groupId and artifactId is groupId specifies the ID of the project group while the artifactId specifies the id of the project. So group Id is always used to identify the project group and artifactId is used to identify the specific project that is developed by that particular group of organization. Please check the below mentioned example:-

All the Selenium related jar files, present in the maven repository has the same groupId as they belongs to same group that is

But different project has project specific artifactId. Like for selenium-java jars, the artifactId is

and for Selenium Firefox Driver jars, the artifactId is

This is introduced by Maven so that updated third party jars can be included in the existing projects and can be updated easily by just changing the properties tag present in the pom.xml file. In that way it increases the maintainability of the third party jars within the individual projects and also inside the Maven repository. Let’s check the below mentioned example:-

Pom.xml sample

In this above mentioned sample pom.xml file, the properties tag contains only the version , which is 5.7.0 of the junit-jupiter-api project (project name equivalent to artifactId) developed by org.junit.jupiter group (all the related jars falls under same group). And now only by changing the version under the properties tag only, the updated jar version can be included inside the user defined projects. In the above example, if different version of junit-jupiter-api jar is required, then only the value under the properties tag need to change.

In the preceding xml , the specific version is passed from the properties tag which is 5.7.0.

In eclipse or any IDE when the project is created with the help of Maven, then the name given under the artifactID becomes the Project Name as mentioned below.

The project name is the name provided inside the artifactId tag in the pom.xml