ben-manes / gradle-versions-plugin

Gradle plugin to discover dependency updates
Apache License 2.0
3.82k stars 199 forks source link

Plugin suggests older version #789

Open ghatasheh opened 1 year ago

ghatasheh commented 1 year ago

Hey, while testing the plugin I found an odd behaviour related to version parsing.

The plugin suggested the following change;

From version 1.10.1 --> 1.2.0 androidx-core-ktx = "androidx.core:core-ktx:1.2.0"

However, 1.10.1 is the most recent version.

Could you please take a look? thanks

ben-manes commented 1 year ago

Can you provide a minimal example build? When I try, I get a correct result:

The following dependencies have later milestone versions:
 - androidx.core:core-ktx [1.10.1 -> 1.12.0-alpha05]
     https://developer.android.com/jetpack/androidx/releases/core#1.12.0-alpha05
sembozdemir commented 10 months ago

Hi @ben-manes, I have a similar issue. 1.12.0 is already released but the plugin always says the latest version should be 1.9.0. https://developer.android.com/jetpack/androidx/releases/core#1.12.0

The following dependencies exceed the version found at the milestone revision level:
 - androidx.core:core [1.10.1 <- 1.9.0]
     https://developer.android.com/jetpack/androidx/releases/core#1.10.1
 - androidx.core:core-ktx [1.10.1 <- 1.9.0]
     https://developer.android.com/jetpack/androidx/releases/core#1.10.1

here is the configuration for dependencyUpdates task.

tasks.named("dependencyUpdates").configure {
  def isNonStable = { String version ->
    def stableKeyword = ['RELEASE', 'FINAL', 'GA'].any { keyword -> version.toUpperCase().contains(keyword) }
    def regex = /^[0-9,.v-]+(-r)?$/
    return !stableKeyword && !(version ==~ regex)
  }

  rejectVersionIf {
    isNonStable(it.candidate.version) && !isNonStable(it.currentVersion)
  }
}

I have removed the configuration and get the same result.

the plugin version I use is 0.47.0

ben-manes commented 10 months ago

can you provide a minimal project that reproduces the problem? As shown above, I wasn't able to reproduce it in a plain java project. However, #798 showed that the Android plugin did something very strange by forcing a resolution constraint. If that's the case then I don't know what they are doing and it would most likely be a bug in their plugin.

extmkv commented 9 months ago

Also facing the same problem with multiple libraries. Screenshot 2023-09-14 at 10 35 02 Screenshot 2023-09-14 at 10 29 08

ben-manes commented 9 months ago

sounds like #798 since you're showing Android with okhttp. If you don't apply the android plugin then it resolves, which means their plugin is doing something incorrect to break Gradle (like an overly broad resolution strategy that restricts version queries). If you confirm it works with the java plugin and fails using the android plugin like #798, then you will need to open an issue with the Google folks. There is nothing we can easily do to work around that.