简体   繁体   English

gradle处理依赖冲突时最高是什么意思?

[英]What does highest means when gradle handle dependency conflict?

I know that gradle choose the highest version when solve dependency conflict by default.我知道gradle在解决依赖冲突时默认选择最高版本。 But what's the definition of highest .但是最高的定义是什么。

I have a dependency conflict problem and I run dependencies task finding that this two version of the same dependency conflicts: AD-106715-1-SNAPSHOT and 1.0.36 .我有一个依赖冲突问题,我运行dependencies任务发现这两个版本的相同依赖冲突: AD-106715-1-SNAPSHOT1.0.36 Gradle choose the 1.0.36 version. Gradle 选择1.0.36版本。

com.mycompany.service:ad-biz-jasper-contract:AD-106715-1-SNAPSHOT -> 1.0.36

But why?但为什么? Is 1.0.36 higher than AD-106715-1-SNAPSHOT ? 1.0.36是否高于AD-106715-1-SNAPSHOT But lexicographically the later one is higher.但按字典顺序,后一个更高。
So I want to know how gradle define which version is higher.所以我想知道 gradle 如何定义哪个版本更高。

The exact rules are described in the Gradle docs , but the short (and somewhat oversimplified) version is: Gradle 文档中描述了确切的规则,但简短(并且有些过于简单)的版本是:

  1. split the version by .拆分版本.
  2. compare each part numerically except if:以数字方式比较每个部分,除非:
    • only one of the parts are numerical, then the numerical part is considered higher只有一个部分是数字的,然后数字部分被认为更高
    • both parts are non-numerical, then sort them alphabetically, case-sensitive两个部分都是非数字的,然后按字母顺序排序,区分大小写

Then there's a couple more rules with special cases for dev , rc , final , ... and what to do when one one string has more parts than the others and the first ones don't give a specific order, but those don't apply in this case.然后还有一些规则,其中devrcfinal ,......的特殊情况以及当一个字符串比其他字符串具有更多部分并且第一个字符串没有给出特定顺序时该怎么办,但那些没有适用于这种情况。

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

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