ben-manes / gradle-versions-plugin

Gradle plugin to discover dependency updates
Apache License 2.0
3.87k stars 200 forks source link

Some versions cannot be detected after 0.28.0 #383

Closed nuhkoca closed 4 years ago

nuhkoca commented 4 years ago

Hi,

The plugin was working great with version 0.27.0. However, it's started not to find some dependency versions with version 0.28.0.

For example; I am currently using Lottie 3.3.1 but they released a new version(3.4.0) 12 days ago. When I run the task, it shows Lottie is up-to-date. There are lots of issues like this.

Release link: https://github.com/airbnb/lottie-android/releases

Is there anything broken?

Thanks,

SUPERCILEX commented 4 years ago

Duplicate of #381.

Though I'm curious, how are you declaring the dependency? It works fine for me.

nuhkoca commented 4 years ago

@SUPERCILEX I declare my dependencies like how I always did in the past while working with older versions of the lib.

object Versions {
    const val lottie = "3.3.1"
}

object Dependencies {
    const val lottie = "dependency:lottie:${Versions.lottie}"
}

I haven't faced any problem so far except for the latest version.

ben-manes commented 4 years ago

What configuration are you using (e.g. compile or implementation)?

nuhkoca commented 4 years ago

@ben-manes I am using implementation("dependency") Kotlin-DSL way.

ben-manes commented 4 years ago

Could you share a reproducible build for us to debug with?

nuhkoca commented 4 years ago

@ben-manes sorry for the belated reply. I will post a Gradle output when I arrive at the office by tomorrow morning.

nuhkoca commented 4 years ago

Hi again @ben-manes,

Please find the example task output below.

> Task :dependencyUpdates

------------------------------------------------------------
: Project Dependency Updates (report to plain text file)
------------------------------------------------------------

The following dependencies are using the latest milestone version:
 - androidx.activity:activity-ktx:1.1.0
 - androidx.appcompat:appcompat:1.1.0
 - androidx.arch.core:core-testing:2.1.0
 - androidx.constraintlayout:constraintlayout:1.1.3
 - androidx.core:core-ktx:1.2.0
 - androidx.databinding:databinding-adapters:3.6.1
 - androidx.databinding:databinding-common:3.6.1
 - androidx.databinding:databinding-compiler:3.6.1
 - androidx.databinding:databinding-runtime:3.6.1
 - androidx.fragment:fragment-ktx:1.2.2
 - androidx.lifecycle:lifecycle-extensions:2.2.0
 - androidx.lifecycle:lifecycle-livedata-ktx:2.2.0
 - androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0
 - androidx.navigation:navigation-fragment-ktx:2.2.1
 - androidx.navigation:navigation-safe-args-gradle-plugin:2.2.1
 - androidx.navigation:navigation-ui-ktx:2.2.1
 - androidx.recyclerview:recyclerview:1.1.0
 - androidx.test:core:1.2.0
 - androidx.test:rules:1.2.0
 - androidx.test:runner:1.2.0
 - androidx.test.espresso:espresso-core:3.2.0
 - androidx.test.ext:junit:1.1.1
 - androidx.test.ext:truth:1.2.0
 - com.airbnb.android:lottie:3.3.1
 - com.bedatadriven:jackson-datatype-jts:2.4
 - com.google.android.gms:play-services-location:17.0.0
 - com.google.dagger:dagger:2.26
 - com.google.dagger:dagger-android-processor:2.26
 - com.google.dagger:dagger-android-support:2.26
 - com.google.dagger:dagger-compiler:2.26
 - com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:0.4.0
 - com.mapbox.mapboxsdk:mapbox-android-navigation-ui:0.42.5
 - com.mapbox.mapboxsdk:mapbox-android-plugin-localization-v8:0.11.0
 - com.mapbox.mapboxsdk:mapbox-android-sdk:9.0.0
 - com.mapzen.android:lost:3.0.4
 - com.pinterest:ktlint:0.36.0
 - com.squareup.okhttp3:logging-interceptor:4.4.0
 - com.squareup.okhttp3:mockwebserver:4.4.0
 - com.squareup.retrofit2:converter-jackson:2.7.1
 - com.squareup.retrofit2:retrofit:2.7.1
 - de.grundid.opendatalab:geojson-jackson:1.12
 - io.mockk:mockk:1.9.3
 - joda-time:joda-time:2.10.5
 - org.jetbrains.kotlin:kotlin-serialization:1.3.70
 - org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3
 - org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.3
 - org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.20.0

The following dependencies exceed the version found at the milestone revision level:
 - org.jetbrains.kotlin:kotlin-android-extensions [1.3.70 <- 1.3.61]
     https://kotlinlang.org/
 - org.jetbrains.kotlin:kotlin-android-extensions-runtime [1.3.70 <- 1.3.61]
     https://kotlinlang.org/
 - org.jetbrains.kotlin:kotlin-annotation-processing-gradle [1.3.70 <- 1.3.61]
     https://kotlinlang.org/
 - org.jetbrains.kotlin:kotlin-serialization-unshaded [1.3.70 <- 1.3.61]
     https://kotlinlang.org/
 - org.jetbrains.kotlin:kotlin-stdlib-jdk8 [1.3.70 <- 1.3.61]
     https://kotlinlang.org/

Gradle release-candidate updates:
 - Gradle: [6.2.2: UP-TO-DATE]

Generated report file /my-path/build/reports/dependencyUpdates/dependency-report.json

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.2.2/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 30s
1 actionable task: 1 executed

For example, Lottie has 3.4.0 and Retrofit has 2.7.2 versions but as you might see in the output, they are marked as up-to-date with older versions.(Lottie 3.3.1, Retrofit 2.7.1). There might be similar cases I didn't search for more dependencies.

Thanks,

ben-manes commented 4 years ago

Can you provide representative build files for us to run ourselves to debug with?

The two most common causes are,

  1. Do you have any resolution strategies defined? They are likely forcing the version.
  2. Do you include mavenCentral In your repositories? Jcenter does not proxy dynamic version lookups and often returns very stale results.
chrimaeon commented 4 years ago

I can also confirm that this is happening. Adding --refresh-dependencies fixes it. Maybe a problem with the new dependency resolution not checking the network but only what's cached inside the Gradle cached!?

Also this was working fine until 0.28.

chrimaeon commented 4 years ago

also @SUPERCILEX, I think this has nothing to do with #381

nuhkoca commented 4 years ago

Can you provide representative build files for us to run ourselves to debug with? A: I provided some files. Apologize If I got you wrong. Please let me know for any inconvenience.

files.zip

The two most common causes are,

  1. Do you have any resolution strategies defined? They are likely forcing the version. A: I am using the default resolution strategy as follows;
resolutionStrategy {
            componentSelection {
                all {
                    if (isNonStable(candidate.version) && !isNonStable(currentVersion)) {
                        reject("Release candidate")
                    }
                }
            }
        }
fun isNonStable(version: String): Boolean {
    val stableKeyword =
        listOf("RELEASE", "FINAL", "GA").any { version.toUpperCase(Locale.ROOT).contains(it) }
    val regex = Config.BUILD_STABLE_REGEX.toRegex()
    val isStable = stableKeyword || regex.matches(version)
    return isStable.not()
}
  1. Do you include mavenCentral In your repositories? Jcenter does not proxy dynamic version lookups and often returns very stale results. A: Yes, both mavenCentral() and jcenter() are used.
ben-manes commented 4 years ago

A minimal build with lottie reported the latest as,

I believe you need to add Maven Central into your repository listing.

plugins {
  id 'java-library'
  id 'com.github.ben-manes.versions' version '0.28.0'
}

repositories {
  mavenCentral()
  jcenter()
}

dependencies {
  api 'com.airbnb.android:lottie:3.3.1'
}
ben-manes commented 4 years ago

You can see in the maven-metadata.xml on JCenter it lists 3.3.1. The MavenCentral version is correct. Always use MavenCentral in your repository listing and use JCenter only as a caching provider.

nuhkoca commented 4 years ago

@ben-manes thanks for your prompt responses. You were right, mavenCentral() was somehow missing in the project. After adding it, that plugin has started to work great again!

Last question, how can I specify jcenter() as a caching provider? Now I am using mavenCentral() and jcenter() together.

Thanks for your time and valuable help!

ben-manes commented 4 years ago

Wonderful.

I just meant to include both and since jcenter acts as a mirror to central you’ll have a fallback in case an outage occurs.

nuhkoca commented 4 years ago

@ben-manes I see, it is great then. Thanks for your help.