Maven依赖项 - 版本与更新

时间:2016-02-12 03:29:41

标签: maven maven-dependency

mvnrepository通常列出"版本"和"更新"每个依赖。

  1. 如果我发布自己的套餐,我该如何指定"更新"版本
  2. Maven在解决传递依赖性时使用了哪种依赖性?因此,如果我的包依赖于包A,它取决于包B的 - version = 1.0和updates = 1.1。我会得到哪个版本的B?

1 个答案:

答案 0 :(得分:47)

I finally understand your question. It would have been helpful for you to give us a concrete example right from the start. You're asking what the meaning of the information in the "Updates" column of MVNRepository's "Compile Dependencies" table is.

enter image description here

It tells you whether there's an updated version of a particular dependency available and if so what the latest version is. If there's a check mark it means the library in question already uses the latest version of dependency X. You will always get the declared version of a dependency no matter what the latest version is.

Hence, if you use valdr-bean-validation 1.1.2 you'll also get jackson-databind 2.4.0 as a transitive dependency. 2.7.1-1 would be the latest available jackson-databind version.