Mavens 依赖声明分类器属性的目的是什么? [英] What is the purpose of Mavens dependency declarations classifier property?

查看:30
本文介绍了Mavens 依赖声明分类器属性的目的是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 pom.xml 文件,我看到它们是为相同的 <artifactId> 引用的 3 个依赖项,不同之处在于标签

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 的依赖项,只保留了一个依赖项.我测试了我的应用程序,一切正常.

I have deleted the dependencies that had the SOURCES/JAVADOCand only kept one dependency. I tested my application and every thing work fine.

使用这个分类器标签的目的是什么?以及为什么我需要复制依赖项两次才能添加 标签和 SOURCES/JAVADOC .

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 distinguishes artifacts that were built from the same POM but differ in content. It is some optional and arbitrary string that - if present - is appended to the artifact name just after the version number.

来源

这篇关于Mavens 依赖声明分类器属性的目的是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆