简体   繁体   中英

What does highest means when gradle handle dependency conflict?

I know that gradle choose the highest version when solve dependency conflict by default. 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 . Gradle choose the 1.0.36 version.

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 ? But lexicographically the later one is higher.
So I want to know how gradle define which version is higher.

The exact rules are described in the Gradle docs , but the short (and somewhat oversimplified) version is:

  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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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