Maven's GroupID and ArtifactID meaning

groupId is generally the reverse of the domain name, and is also used as the package name of the class in the project.
artifactId is the project name, that is, the root folder name.


groupId : the unique identifier of the organization or group that created the project


artifactId : unique base name of the project The primary artifact being generated by this project


GroupID is the unique identifier of the project organization, which actually corresponds to the structure of the JAVA package, which is the directory structure of java in the main directory.


ArtifactID is the unique identifier of the project, and the actual name of the corresponding project is the name of the project root directory.






-----------------1 Basic knowledge required----------------------------

<groupId>com.yucong.commonmaven</groupId>
<artifactId>commonmaven</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>common_maven</name>

groupId

definition For example, if your company is mycom and a project is myapp, then the groupId should be com.mycom.myapp.



Defines the unique ID of the current maven project in the group, for example, myapp-util, myapp-domain, myapp-web, etc.

version

specifies the current version of the myapp project, and SNAPSHOT means snapshot, indicating that the project is still under development and is an unstable version.

name

declares a more user-friendly project name. It is not required. It is recommended to declare a name for each pom to facilitate information exchange.



-----------------2 What are mave coordinates----------------------------

There are a huge number of components in the maven world, that is, some jar, war and other files that are usually used.

Maven defines such a set of rules:

any component in the world can be uniquely identified by Maven coordinates, and the elements of maven coordinates include groupId, artifactId, version, package, and classifier.

As long as the groupId, artifact, verison, classifier of dependancy is configured in the pom.xml file,

maven will find the corresponding components from the warehouse for us to use. So, "Where does maven download components from?" The

answer is very simple, maven has a built-in address of a central repository (http://repol.maven.org/maven2), the central repository contains most of the world's popular Open source project components, maven will go there to download when needed.



-----------------3 Coordinate details----------------------------

<groupId>org.sonatype.nexus</groupId>

<artifactId>nexus-indexer</artifactId>

<version>2.0.0</version>

<packaging>jar</packaging>

groupId

defines the actual project to which the current maven project belongs.

The representation of groupId is similar to the representation of Java package names, such as: <groupId>org.sonatype.nexus</groupId>



artifactId

This element defines a Maven project (module) in the actual project. The recommended approach is to use the actual project's The name is prefixed to the artifactId.

For example: <artifactId>nexus-indexer</artifactId>

By default, the file name of the component generated by maven will start with artifactId, such as: nexus-indexer-2.0.0.jar.



packaging [optional, defaults to jar]:

When packaging is not defined, maven will use the default value of jar.



classifier:

This element is used to help define some subsidiary components of the component output.



The file name of the project component is corresponding to the coordinates. The general rule is: artifact-version.packing

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326712545&siteId=291194637