简体   繁体   English

Maven 存储库网站中的托管依赖项是什么?

[英]What is managed dependencies in maven repository website?

I know maven dependencies have different scopes.我知道 Maven 依赖项有不同的范围。

But what is Managed Dependencies ?但是什么是Managed Dependencies

在此处输入图片说明

The dependency you are looking at is not a jar file but a pom.xml that is meant to be used as "bom" (bill of materials).您正在查看的依赖项不是 jar 文件,而是用于用作“bom”(材料清单)的 pom.xml。 It contains the preferred versions of dependencies, so you would not need to inherit from that parent pom to use those version numbers but you can import them.它包含依赖项的首选版本,因此您无需从该父 pom 继承即可使用这些版本号,但您可以导入它们。 See BOM section in the introduction: https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#bill-of-materials-bom-poms请参阅介绍中的 BOM 部分: https : //maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#bill-of-materials-bom-poms

if you look into that pom.xml file: https://search.maven.org/artifact/org.apache.logging.log4j/log4j/2.13.3/pom you will see the dependencyManagegement section.如果您查看该 pom.xml 文件: https : //search.maven.org/artifact/org.apache.logging.log4j/log4j/2.13.3/pom,您将看到dependencyManagegement部分。 If you import that pom that section is added to your own dependencyManagement secion (sort of).如果您导入该 pom,该部分将添加到您自己的 dependencyManagement 部分(有点)。 Its not dependencies yet, just preferred versions.它还不是依赖项,只是首选版本。

these kind of dependencies can only be added into the dependencyManagement section of the pom.xml - I assume the gradle dependency resolution follows that behaviour but I'm not sure about that, bom support took a while in gradle to be supported.这些类型的依赖项只能添加到pom.xmldependencyManagement部分 - 我假设 gradle 依赖项解析遵循该行为,但我不确定,在 gradle 中支持 bom 需要一段时间才能支持。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM