ben-manes / gradle-versions-plugin

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

resolve androidx dependencies from maven.google.com #804

Closed kibotu closed 10 months ago

kibotu commented 10 months ago

as far as I can tell, the dependency versions are being provided by mvncentral:

however it lags behind the versions from google's maven server, e.g.

https://maven.google.com/web/index.html?q=androidx.compose.foundation#androidx.compose.foundation:foundation

Screenshot 2023-08-22 at 10 08 48 https://mvnrepository.com/artifact/androidx.compose.foundation/foundation-layout?repo=google

Screenshot 2023-08-22 at 10 08 45

is it possible to also check google's server for androidx dependencies?

ben-manes commented 10 months ago

We use whatever repositories are configured in your build, so if you add Google’s then it should be checked.

kibotu commented 10 months ago

the config looks like this

it uses maven central version for some reason :/


buildscript {

    repositories {
        maven { url "https://maven-central-eu.storage-download.googleapis.com/maven2/" }
        google()
        mavenCentral()
        gradlePluginPortal()
        maven { url 'https://jitpack.io' }
    }
    dependencies {
        classpath "com.github.ben-manes:gradle-versions-plugin:0.47.0"
        classpath "org.jfrog.buildinfo:build-info-extractor-gradle:5.1.0"
    }
}

allprojects {

    repositories {
        maven { url "https://maven-central-eu.storage-download.googleapis.com/maven2/" }
        google()
        mavenCentral()
        gradlePluginPortal()
        maven { url 'https://jitpack.io' }
    }
}
ben-manes commented 10 months ago

I usually run this task using --refresh-dependencies to force Gradle to query the repositories anew, or else it uses it the dependency cache (24 hour ttl, iirc). Does that help?

I recall annoyances of gradle halting the resolution on the the first repository listed that contains the dependency. That might be faster but was also annoying and error prone. You could try moving google() above to see if that fixes it. I think they restored the behavior of querying all and instead added repository content filtering so that for performance you can target certain repositories for a dependency. This way you could force androidx to go to google() and not mavenCental().

kibotu commented 10 months ago

thanks for your comment! it pointed me into the right direction:

    maven { url "https://dl.google.com/android/maven2" }
    // google() //  https://dl.google.com/android/maven2/androidx/

the google one does not point to the correct maven server for some reason o.O changing it to https://dl.google.com/android/maven2 all androidx google dependencies are being resolved now correctly