POM 关系
Maven 一个很强的地方是它的对于项目关系的处理,包含了依赖(transitive dependencies,在这里可能应该理解为传递依赖),继承,和聚合(多模块项目)。
Dependencies 依赖
1 | ... |
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: