java maven POM 中 artifactId 和 name 的区别
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/38594036/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
difference of artifactId and name in maven POM
提问by javako
I am new to maven and I'm confused about the difference between the artifactId
and name
.
我是 maven 的新手,我对artifactId
和之间的区别感到困惑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>
.
我所知道的是,这artifactId
是您正在创建的工件的名称。我知道artifactId
与groupId
is一起用于唯一标识工件。那么<name>
POM 中的目的是什么?就像我从一个网站得到的下面的 pom 一样,有artifactId
一个<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>
回答by OneCricketeer
You are correct that the artifactId
helps identify the project.
您是正确的,这artifactId
有助于识别项目。
The name
is simply a human-readable "friendly" name. It is not required for a basic setup.
这name
只是一个人类可读的“友好”名称。基本设置不需要它。
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.
artifactId: artifactId 通常是项目的名称。尽管 groupId 很重要,但组内的人很少会在讨论中提及 groupId ......它与 groupId 一起创建了一个将这个项目与世界上所有其他项目分开的密钥(至少,它应该:)) . 与 groupId 一起,artifactId 完全定义了工件在存储库中的生活区。
回答by tchambers
The groupId
, artifactId
and version
form a composite unique identifier (or coordinate) for this project. Each of these values has a fairly rigid naming convention that allows well organized groups, artifacts and versions.
的groupId
,artifactId
并version
形成复合唯一标识符(或坐标)这个项目。这些值中的每一个都有一个相当严格的命名约定,允许组织良好的组、工件和版本。
The name
is simply a readable name for the project and does not need to be unique or comply to the same conventions (so it can contain spaces and other characters).
Thename
只是项目的可读名称,不需要唯一或符合相同的约定(因此它可以包含空格和其他字符)。