栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

pom 关系

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

pom 关系

POM 关系

Maven 一个很强的地方是它的对于项目关系的处理,包含了依赖(transitive dependencies,在这里可能应该理解为传递依赖),继承,和聚合(多模块项目)。

Dependencies 依赖
...
  
    
      junit
      junit
      4.12
      jar
      test
      true
    
    ...
  
  ...

groupId、artifactId、version:
这里的 version 还可以用一种专门的语法来约束,不需要指定固定的某一个版本,这个知识点在别的笔记里面记录过,这个知识点 JS、Python 也都是使用。

classifier:

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.
As a motivation for this element, consider for example a project that offers an artifact targeting Java 11 but at the same time also an artifact that still supports Java 1.8. The first artifact could be equipped with the classifier jdk11 and the second one with jdk8 such that clients can choose which one to use.
Another common use case for classifiers is to attach secondary artifacts to the project’s main artifact. If you browse the Maven central repository, you will notice that the classifiers sources and javadoc are used to deploy the project source code and API docs along with the packaged class files.

这个好像是说制品根据这个属性可以有不同的分类,例如可以生成支持 Java 11 的或者生成 Java 1.8 的,或者还可以生成附属的制品,例如 sources 和 javadoc。
其实总体来说,还是有些不明白。

type:
依赖的类型,默认是 jar。

scope:
范围,这个元素指的是手头任务的 classpath,以及如何限制依赖的传递性。
这个在 gradle 里面有对应的动词,可以对应总结一下。

in hand vs at hand vs on hand 的区别:

总体感觉意思差不多,只是一个比一个更近一些。

systemPath:

optional:

参考

https://maven.apache.org/pom.html#pom-relationships
https://english.stackexchange.com/questions/55040/at-hand-vs-on-hand-vs-in-hand#:~:text=What’s%20the%20difference%20between%20at,more%20time%20at%20your%20disposal.

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/867994.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号