ben-manes / gradle-versions-plugin

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

Can't resolve a bunch of dependencies, not sure why #803

Closed kibotu closed 1 year ago

kibotu commented 1 year ago

the following dependencies can't be resolved:

note: glide compiler fails, but glide works o.O https://mvnrepository.com/artifact/com.github.bumptech.glide/compiler https://mvnrepository.com/artifact/com.github.bumptech.glide/glide

I can't think of a reason why, e.g. okhttp fails, it's also available on mvncentral https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp

Failed to determine the latest version for the following dependencies (use --info for details):
 - androidx.compose.ui:ui-test-junit4
 - com.airbnb.android:showkase-processor
 - com.github.blocoio:faker
 - com.github.bumptech.glide:compiler
 - com.github.mrmike:ok2curl
 - com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter
 - com.squareup.moshi:moshi
 - com.squareup.moshi:moshi-adapters
 - com.squareup.okhttp3:logging-interceptor
 - com.squareup.okhttp3:okhttp
 - dev.zacsweers.moshix:moshi-ksp
 - io.reactivex.rxjava3:rxjava
 - org.jetbrains.kotlinx:kotlinx-coroutines-android
 - org.jetbrains.kotlinx:kotlinx-coroutines-play-services
 - org.robolectric:robolectric

i'm using the following configuration:


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' }
    }
}

// dependency versions ./gradlew dependencyUpdates
apply plugin: 'com.github.ben-manes.versions'
apply plugin: "com.jfrog.artifactory"
apply plugin: 'maven-publish'

dependencyUpdates.resolutionStrategy {
    componentSelection { rules ->
        rules.all { ComponentSelection selection ->
            boolean rejected = ['alpha', 'beta', 'rc', 'cr', 'm', 'preview', 'b', 'ea', 'dev01'].any { qualifier ->
                selection.candidate.version ==~ /(?i).*[.-]$qualifier[.\d+-]*/
            }
            if (rejected) {
                selection.reject('Release candidate')
            }
        }
    }
}
ben-manes commented 1 year ago

Usually that means something else, like a resolution strategy, failed (like an npe) and had a large blast radius. You can look as the info log for the errors to see where the problem might be.

kibotu commented 1 year ago

good point!

i've attached the log file of

./gradlew --refresh-dependencies --s dependencyUpdates -DoutputFormatter=plain,xml,html --info > build.txt

build.txt

I can't make sense out of the exceptions exactly though :/

It's trying to find a variant with attribute 'org.gradle.jvm.version' with value '2147483647', but none of the available variants match this. The key is in this line: "The consumer was configured to find attribute 'org.gradle.jvm.version' with value '2147483647'."

We don't use version wildcards though.

ben-manes commented 1 year ago

By chance do you have empty sub-projects (https://github.com/ben-manes/gradle-versions-plugin/issues/746)?

That is the TARGET_JVM_VERSION_ATTRIBUTE attribute saying it is compatible with any jvm version (Integer.MAX_VALUE). It was added based on the advice from a Gradle engineer in #727.

kibotu commented 1 year ago

Bullseye! That was it, thanks a lot, I've moved my script into a separate job where it is the root gradle project + applying the apply plugin: 'jvm-ecosystem' and it works now as expected :)