Mavens依赖声明分类器属性的目的是什么? [英] What is the purpose of Mavens dependency declarations classifier property?
问题描述
我有一个pom.xml文件,因为我看到他们的3个依赖项引用了相同的< artifactId>
差异在于标签
I have a pom.xml file and in that i see that their are 3 dependencies referenced for same <artifactId>
the difference are in tags
<classifier>sources</classifier>
<classifier>javadoc</classifier>
我删除了具有 SOURCES / JAVADOC $ c的依赖项$ c>并且只保留一个依赖项。我测试了我的应用程序,每件事情都很好。
I have deleted the dependencies that had the SOURCES/JAVADOC
and only kept one dependency. I tested my application and every thing work fine.
使用此分类器标签的目的是什么?以及为什么我需要两次复制依赖项,以便使用 SOURCES / JAVADOC
添加< classifier>
标记。
What is the purpose of using this classifier tag? and why i need to duplicate dependencies twice for adding <classifier>
tag with SOURCES/JAVADOC
.
<dependency>
<groupId>oauth.signpost</groupId>
<artifactId>signpost-commonshttp4</artifactId>
<version>1.2.1.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>oauth.signpost</groupId>
<artifactId>signpost-commonshttp4</artifactId>
<version>1.2.1.2</version>
<type>jar</type>
***<classifier>javadoc</classifier>***
<scope>compile</scope>
</dependency>
<dependency>
<groupId>oauth.signpost</groupId>
<artifactId>signpost-commonshttp4</artifactId>
<version>1.2.1.2</version>
<type>jar</type>
***<classifier>sources</classifier>***
<scope>compile</scope>
</dependency>
推荐答案
分类器允许区分从中构建的工件相同的POM但内容不同。它是一些可选的任意字符串 - 如果存在 - 将在版本号之后附加到工件名称。
The classifier allows to distinguish artifacts that were built from the same POM but differ in their content. It is some optional and arbitrary string that - if present - is appended to the artifact name just after the version number.
以获取详细信息检查http://maven.apache.org/pom.html
这篇关于Mavens依赖声明分类器属性的目的是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!