Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running dependencyUpdates in projects without jvm-ecosystem can fail to resolve updated versions #746

Open
jvandort opened this issue Mar 14, 2023 · 17 comments

Comments

@jvandort
Copy link
Contributor

jvandort commented Mar 14, 2023

Steps to Reproduce

  1. Checkout https://github.com/ben-manes/caffeine
  2. Run dependencyUpdates
  3. See output:
> Task :dependencyUpdates

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

The following dependencies are using the latest milestone version:
...

The following dependencies have later milestone versions:
...

Failed to determine the latest version for the following dependencies (use --info for details):
 - com.beust:jcommander
     1.82

Running with info shows:

Failed to determine the latest version for the following dependencies (use --info for details):
 - com.beust:jcommander
     1.82
The exception that is the cause of unresolved state: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve com.beust:jcommander:+.
Required by:
    project :
Caused by: org.gradle.internal.component.NoMatchingConfigurationSelectionException: No matching variant of com.beust:jcommander:1.82 was found. The consumer was configured to find attribute 'org.gradle.jvm.version' with value '2147483647' but:
  - Variant 'apiElements' capability com.beust:jcommander:1.82:
      - Incompatible because this component declares attribute 'org.gradle.jvm.version' with value '8' and the consumer needed attribute 'org.gradle.jvm.version' with value '2147483647'
  - Variant 'runtimeElements' capability com.beust:jcommander:1.82:
      - Incompatible because this component declares attribute 'org.gradle.jvm.version' with value '8' and the consumer needed attribute 'org.gradle.jvm.version' with value '2147483647'

Resolution

In general, any project which performs dependency-resolution on JVM artifacts must apply the jvm-ecosystem plugin. The versions plugin sets the TARGET_JVM_VERSION_ATTRIBUTE attribute and therefore must apply this plugin.

To see the resolution in action, add apply plugin: 'jvm-ecosystem' to the root build.gradle file in caffeine.

Context: #727 (comment)

@LloydBlv
Copy link

LloydBlv commented Dec 9, 2023

Hi

I'm facing same issue, tried to add the jvm-ecosystem:

allprojects {
    repositories {
        google()
        mavenCentral()
        maven("https://jitpack.io")
    }

    apply(plugin = "jvm-ecosystem")
    apply(plugin = rootProject.libs.plugins.benversions.get().pluginId)
}

but still no luck,

Gradle version: 8.4
Plugin version: 3.13

com.gradle.scan.plugin.internal.m.a: Build operation dispatch of finished notification failed.
Operation context: 
        org.gradle.launcher.exec.RunAsBuildOperationBuildActionExecutor$1 (3540837): {}
        org.gradle.execution.RunRootBuildWorkBuildOperationType$Details (3586626): {getBuildStartTime=1702092862436}
        org.gradle.api.internal.tasks.execution.ExecuteTaskBuildOperationDetails (3586647): {buildPath=:, taskPath=:domain:dependencyUpdates, taskClass=com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask, taskId=101}
        org.gradle.internal.execution.steps.ExecuteStep$1$1 (3586658): {getIdentity=org.gradle.api.internal.tasks.execution.TaskExecution$$Lambda$3183/0x000000c802cad730@59e4ecfc, getWorkType=class org.gradle.api.internal.tasks.execution.TaskExecution}
        org.gradle.api.internal.tasks.execution.ExecuteTaskActionBuildOperationType$1 (3586667): {}
        org.gradle.api.internal.artifacts.configurations.ResolveConfigurationResolutionBuildOperationDetails (3586827): {describe error: java.lang.IllegalAccessException: class com.gradle.scan.plugin.internal.m.a cannot access a member of class org.gradle.api.internal.artifacts.configurations.ResolveConfigurationResolutionBuildOperationDetails with modifiers "public"}
Caused by: org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':domain:alphaCompileClasspathCopy2'.
        at org.gradle.api.internal.artifacts.ResolveExceptionContextualizer.contextualize(ResolveExceptionContextualizer.java:55)
        at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingConfigurationResolver$ErrorHandlingResolutionResult.getRoot(ErrorHandlingConfigurationResolver.java:202)
        at org.gradle.api.internal.artifacts.configurations.ResolveConfigurationResolutionBuildOperationResult.getRootComponent(ResolveConfigurationResolutionBuildOperationResult.java:60)
        at com.gradle.scan.plugin.internal.c.i.a.e$a.b(SourceFile:115)
        at com.gradle.scan.plugin.internal.c.i.a.e$a.a(SourceFile:72)
        at com.gradle.scan.plugin.internal.c.i.a.e.a(SourceFile:51)
        at com.gradle.scan.plugin.internal.c.i.a.d.a(SourceFile:176)
        at com.gradle.scan.plugin.internal.c.i.c.a(SourceFile:140)
        at com.gradle.scan.plugin.internal.m.b$c.finished(SourceFile:154)
        at com.gradle.scan.plugin.internal.m.b.a(SourceFile:65)
        at com.gradle.scan.plugin.internal.m.n.a(SourceFile:56)
        at com.gradle.scan.plugin.internal.m.d.a(SourceFile:109)
        at com.gradle.scan.plugin.internal.m.h.a(SourceFile:51)
        at com.gradle.scan.plugin.internal.r.a$a.a(SourceFile:31)
        at com.gradle.scan.plugin.internal.r.a$a.a(SourceFile:20)
        at com.gradle.scan.plugin.internal.r.a.c(SourceFile:67)
Caused by: java.lang.RuntimeException: Problems reading data from Binary store in /Users/rr/.gradle/.tmp/gradle1807125533685119676.bin offset 7226 exists? true
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.DefaultBinaryStore$SimpleBinaryData.read(DefaultBinaryStore.java:136)
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.StreamingResolutionResultBuilder$RootFactory.lambda$create$0(StreamingResolutionResultBuilder.java:189)
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.CachedStoreFactory$SimpleStore.load(CachedStoreFactory.java:101)
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.StreamingResolutionResultBuilder$RootFactory.create(StreamingResolutionResultBuilder.java:187)
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.StreamingResolutionResultBuilder$RootFactory.create(StreamingResolutionResultBuilder.java:159)
        at org.gradle.api.internal.artifacts.result.DefaultResolutionResult.getRoot(DefaultResolutionResult.java:51)
        at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingConfigurationResolver$ErrorHandlingResolutionResult.getRoot(ErrorHandlingConfigurationResolver.java:200)
        ... 14 more
Caused by: java.lang.RuntimeException: Problems loading the resolution results (0.0 secs). Read 9 values, last was: 5
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.StreamingResolutionResultBuilder$RootFactory.deserialize(StreamingResolutionResultBuilder.java:245)
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.DefaultBinaryStore$SimpleBinaryData.read(DefaultBinaryStore.java:134)
        ... 20 more
Caused by: java.lang.IllegalStateException: Corrupt serialized resolution result. Cannot find selected component (4697) for constraint alphaCompileClasspathCopy2 -> com.jakewharton.threetenabp:threetenabp:{strictly 1.4.6}
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.DefaultResolutionResultBuilder.visitOutgoingEdges(DefaultResolutionResultBuilder.java:131)
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.StreamingResolutionResultBuilder$RootFactory.deserialize(StreamingResolutionResultBuilder.java:237)
        ... 21 more
----------

Configuration cache entry discarded with 256 problems.

@ben-manes
Copy link
Owner

That seems to be unrelated and I have never seen that error before,

Corrupt serialized resolution result. Cannot find selected component

It sounds like some persisted state is bad so you might try to deleting the .gradle and ~/gradle/caches directories and running with --no-configuration-cache and --no-build-cache`, to see any of those fix a build problem.

You could try skipping that configuration,

tasks.named("dependencyUpdates").configure {
  filterConfigurations {
    !it.name.contains("alphaCompileClasspath")
  }
}

@LloydBlv
Copy link

LloydBlv commented Dec 9, 2023

Hi Ben,

Thanks for your quick reply,

I deleted the whoe .gradle folder and updated the "dependencyUpdates" config block as below:

tasks.withType<DependencyUpdatesTask> {
    checkForGradleUpdate = true
    outputFormatter = "html"
    outputDir = "build/dependencyUpdates"
    reportfileName = "report"
    rejectVersionIf {
        isNonStable(candidate.version)
    }
    filterConfigurations = Spec<Configuration> {
        !it.name.contains("alphaCompileClasspath")
    }
}

and ran the following command:

./gradlew dependencyUpdates -DoutputFormatter=html --warning-mode all --no-configuration-cache --no-build-cache

but still got the following error:

----------
Gradle version: 8.4
Plugin version: 3.13

com.gradle.scan.plugin.internal.m.a: Build operation dispatch of finished notification failed.
Operation context: 
        org.gradle.launcher.exec.RunAsBuildOperationBuildActionExecutor$1 (3936496): {}
        org.gradle.execution.RunRootBuildWorkBuildOperationType$Details (3982284): {getBuildStartTime=1702094973703}
        org.gradle.api.internal.tasks.execution.ExecuteTaskBuildOperationDetails (3982291): {buildPath=:, taskPath=:domain:dependencyUpdates, taskClass=com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask, taskId=101}
        org.gradle.internal.execution.steps.ExecuteStep$1$1 (3982317): {getIdentity=org.gradle.api.internal.tasks.execution.TaskExecution$$Lambda$3183/0x000000c802cad730@67cb69c7, getWorkType=class org.gradle.api.internal.tasks.execution.TaskExecution}
        org.gradle.api.internal.tasks.execution.ExecuteTaskActionBuildOperationType$1 (3982319): {}
        org.gradle.api.internal.artifacts.configurations.ResolveConfigurationResolutionBuildOperationDetails (3982589): {describe error: java.lang.IllegalAccessException: class com.gradle.scan.plugin.internal.m.a cannot access a member of class org.gradle.api.internal.artifacts.configurations.ResolveConfigurationResolutionBuildOperationDetails with modifiers "public"}
Caused by: org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':domain:alphaCompileClasspathCopy2'.
        at org.gradle.api.internal.artifacts.ResolveExceptionContextualizer.contextualize(ResolveExceptionContextualizer.java:55)
        at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingConfigurationResolver$ErrorHandlingResolutionResult.getRoot(ErrorHandlingConfigurationResolver.java:202)
        at org.gradle.api.internal.artifacts.configurations.ResolveConfigurationResolutionBuildOperationResult.getRootComponent(ResolveConfigurationResolutionBuildOperationResult.java:60)
        at com.gradle.scan.plugin.internal.c.i.a.e$a.b(SourceFile:115)
        at com.gradle.scan.plugin.internal.c.i.a.e$a.a(SourceFile:72)
        at com.gradle.scan.plugin.internal.c.i.a.e.a(SourceFile:51)
        at com.gradle.scan.plugin.internal.c.i.a.d.a(SourceFile:176)
        at com.gradle.scan.plugin.internal.c.i.c.a(SourceFile:140)
        at com.gradle.scan.plugin.internal.m.b$c.finished(SourceFile:154)
        at com.gradle.scan.plugin.internal.m.b.a(SourceFile:65)
        at com.gradle.scan.plugin.internal.m.n.a(SourceFile:56)
        at com.gradle.scan.plugin.internal.m.d.a(SourceFile:109)
        at com.gradle.scan.plugin.internal.m.h.a(SourceFile:51)
        at com.gradle.scan.plugin.internal.r.a$a.a(SourceFile:31)
        at com.gradle.scan.plugin.internal.r.a$a.a(SourceFile:20)
        at com.gradle.scan.plugin.internal.r.a.c(SourceFile:67)
Caused by: java.lang.RuntimeException: Problems reading data from Binary store in /Users/rr/.gradle/.tmp/gradle17814840834025670751.bin offset 7226 exists? true
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.DefaultBinaryStore$SimpleBinaryData.read(DefaultBinaryStore.java:136)
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.StreamingResolutionResultBuilder$RootFactory.lambda$create$0(StreamingResolutionResultBuilder.java:189)
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.CachedStoreFactory$SimpleStore.load(CachedStoreFactory.java:101)
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.StreamingResolutionResultBuilder$RootFactory.create(StreamingResolutionResultBuilder.java:187)
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.StreamingResolutionResultBuilder$RootFactory.create(StreamingResolutionResultBuilder.java:159)
        at org.gradle.api.internal.artifacts.result.DefaultResolutionResult.getRoot(DefaultResolutionResult.java:51)
        at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingConfigurationResolver$ErrorHandlingResolutionResult.getRoot(ErrorHandlingConfigurationResolver.java:200)
        ... 14 more
Caused by: java.lang.RuntimeException: Problems loading the resolution results (0.0 secs). Read 9 values, last was: 5
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.StreamingResolutionResultBuilder$RootFactory.deserialize(StreamingResolutionResultBuilder.java:245)
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.DefaultBinaryStore$SimpleBinaryData.read(DefaultBinaryStore.java:134)
        ... 20 more
Caused by: java.lang.IllegalStateException: Corrupt serialized resolution result. Cannot find selected component (7356) for constraint alphaCompileClasspathCopy2 -> com.jakewharton.threetenabp:threetenabp:{strictly 1.4.6}
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.DefaultResolutionResultBuilder.visitOutgoingEdges(DefaultResolutionResultBuilder.java:131)
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.StreamingResolutionResultBuilder$RootFactory.deserialize(StreamingResolutionResultBuilder.java:237)
        ... 21 more
----------

@ben-manes
Copy link
Owner

I'm not sure if this is somehow related to the build scan plugin? Perhaps try --no-scan

@LloydBlv
Copy link

LloydBlv commented Dec 9, 2023

Tried the following but same result:

./gradlew dependencyUpdates -DoutputFormatter=html --warning-mode all --no-configuration-cache --no-build-cache --no-scan

@ben-manes
Copy link
Owner

ben-manes commented Dec 9, 2023

It seems more like a Gradle bug. A search for "Problems reading data from Binary store" leads to a few suggestions, like trying --no-parallel and --no-configure-on-demand

@LloydBlv
Copy link

LloydBlv commented Dec 9, 2023

tried the following:

./gradlew dependencyUpdates -DoutputFormatter=html --warning-mode all --no-configuration-cache --no-build-cache --no-scan --no-configure-on-demand --no-parallel

but failed:

----------
Gradle version: 8.4
Plugin version: 3.13

com.gradle.scan.plugin.internal.m.a: Build operation dispatch of finished notification failed.
Operation context: 
        org.gradle.launcher.exec.RunAsBuildOperationBuildActionExecutor$1 (258721): {}
        org.gradle.execution.RunRootBuildWorkBuildOperationType$Details (304509): {getBuildStartTime=1702095861711}
        org.gradle.api.internal.tasks.execution.ExecuteTaskBuildOperationDetails (304511): {buildPath=:, taskPath=:dependencyUpdates, taskClass=com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask, taskId=20}
        org.gradle.internal.execution.steps.ExecuteStep$1$1 (304515): {getIdentity=org.gradle.api.internal.tasks.execution.TaskExecution$$Lambda$2571/0x000000700278a5a0@25fc284c, getWorkType=class org.gradle.api.internal.tasks.execution.TaskExecution}
        org.gradle.api.internal.tasks.execution.ExecuteTaskActionBuildOperationType$1 (304516): {}
        org.gradle.api.internal.artifacts.configurations.ResolveConfigurationResolutionBuildOperationDetails (306538): {describe error: java.lang.IllegalAccessException: class com.gradle.scan.plugin.internal.m.a cannot access a member of class org.gradle.api.internal.artifacts.configurations.ResolveConfigurationResolutionBuildOperationDetails with modifiers "public"}
Caused by: org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':app:freeBazaarDebugAndroidTestRuntimeClasspathCopy2'.
        at org.gradle.api.internal.artifacts.ResolveExceptionContextualizer.contextualize(ResolveExceptionContextualizer.java:55)
        at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingConfigurationResolver$ErrorHandlingResolutionResult.getRoot(ErrorHandlingConfigurationResolver.java:202)
        at org.gradle.api.internal.artifacts.configurations.ResolveConfigurationResolutionBuildOperationResult.getRootComponent(ResolveConfigurationResolutionBuildOperationResult.java:60)
        at com.gradle.scan.plugin.internal.c.i.a.e$a.b(SourceFile:115)
        at com.gradle.scan.plugin.internal.c.i.a.e$a.a(SourceFile:72)
        at com.gradle.scan.plugin.internal.c.i.a.e.a(SourceFile:51)
        at com.gradle.scan.plugin.internal.c.i.a.d.a(SourceFile:176)
        at com.gradle.scan.plugin.internal.c.i.c.a(SourceFile:140)
        at com.gradle.scan.plugin.internal.m.b$c.finished(SourceFile:154)
        at com.gradle.scan.plugin.internal.m.b.a(SourceFile:65)
        at com.gradle.scan.plugin.internal.m.n.a(SourceFile:56)
        at com.gradle.scan.plugin.internal.m.d.a(SourceFile:109)
        at com.gradle.scan.plugin.internal.m.h.a(SourceFile:51)
        at com.gradle.scan.plugin.internal.r.a$a.a(SourceFile:31)
        at com.gradle.scan.plugin.internal.r.a$a.a(SourceFile:20)
        at com.gradle.scan.plugin.internal.r.a.c(SourceFile:67)
Caused by: java.lang.RuntimeException: Problems reading data from Binary store in /Users/rr/.gradle/.tmp/gradle18011881121691228218.bin offset 527497 exists? true
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.DefaultBinaryStore$SimpleBinaryData.read(DefaultBinaryStore.java:136)
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.StreamingResolutionResultBuilder$RootFactory.lambda$create$0(StreamingResolutionResultBuilder.java:189)
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.CachedStoreFactory$SimpleStore.load(CachedStoreFactory.java:101)
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.StreamingResolutionResultBuilder$RootFactory.create(StreamingResolutionResultBuilder.java:187)
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.StreamingResolutionResultBuilder$RootFactory.create(StreamingResolutionResultBuilder.java:159)
        at org.gradle.api.internal.artifacts.result.DefaultResolutionResult.getRoot(DefaultResolutionResult.java:51)
        at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingConfigurationResolver$ErrorHandlingResolutionResult.getRoot(ErrorHandlingConfigurationResolver.java:200)
        ... 14 more
Caused by: java.lang.RuntimeException: Problems loading the resolution results (0.0 secs). Read 14 values, last was: 5
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.StreamingResolutionResultBuilder$RootFactory.deserialize(StreamingResolutionResultBuilder.java:245)
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.DefaultBinaryStore$SimpleBinaryData.read(DefaultBinaryStore.java:134)
        ... 20 more
Caused by: java.lang.IllegalStateException: Corrupt serialized resolution result. Cannot find selected component (20536) for constraint freeBazaarDebugAndroidTestRuntimeClasspathCopy2 -> androidx.compose:compose-bom:{strictly 2023.10.01}
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.DefaultResolutionResultBuilder.visitOutgoingEdges(DefaultResolutionResultBuilder.java:131)
        at org.gradle.api.internal.artifacts.ivyservice.resolveengine.result.StreamingResolutionResultBuilder$RootFactory.deserialize(StreamingResolutionResultBuilder.java:237)
        ... 21 more
----------

also the github action running this command is generating a HTML file but no version is resolved:

Failed to determine the latest version for the following dependencies:

it used to work fine before and all of a sudden stopped working

@ben-manes
Copy link
Owner

oh, maybe delete the github action caches or running without them enabled?

These issues are usually caused by corner cases in the dependency graph computation. That's why changing declaration order or adding / removing dependencies can make the problem go away.
Unfortunately, these issues are hard to track without an isolated reproducer.
-- gradle/gradle#14220

So I guess you could try making some random changes to unstick it? I think you might need to ask the Gradle team for help.

@LloydBlv
Copy link

LloydBlv commented Dec 9, 2023

Tried cleaning the caches but still no dependency is resolved, btw I'm getting lots of these warnings:

While resolving configuration 'freeGoogleplayReleaseUnitTestCompileClasspathCopy', it was also selected as a variant. Configurations should not act as both a resolution root and a variant simultaneously. Depending on the resolved configuration in this manner has been deprecated. This will fail with an error in Gradle 9.0. Be sure to mark configurations meant for resolution as canBeConsumed=false or use the 'resolvable(String)' configuration factory method to create them. Consult the upgrading guide for further information:

maybe this gives a clue?

@LloydBlv
Copy link

LloydBlv commented Dec 9, 2023

More warnings:

> Task :dependencyUpdates
Build service 'com.android.build.gradle.internal.services.StringCachingBuildService_d3e9e22e-3615-41d1-a706-6b0074b365b3' is being used by task ':dependencyUpdates' without the corresponding declaration via 'Task#usesService'. This behavior has been deprecated. This will fail with an error in Gradle 9.0. Declare the association between the task and the build service using 'Task#usesService'. Consult the upgrading guide for further information: https://docs.gradle.org/8.5/userguide/upgrading_version_7.html#undeclared_build_service_usage
The freeBazaarAlphaUnitTestCompileClasspathCopy configuration has been deprecated for consumption. This will fail with an error in Gradle 9.0. For more information, please refer to https://docs.gradle.org/8.5/userguide/declaring_dependencies.html#sec:deprecated-configurations in the Gradle documentation.
While resolving configuration 'freeBazaarAlphaUnitTestCompileClasspathCopy', it was also selected as a variant. Configurations should not act as both a resolution root and a variant simultaneously. Depending on the resolved configuration in this manner has been deprecated. This will fail with an error in Gradle 9.0. Be sure to mark configurations meant for resolution as canBeConsumed=false or use the 'resolvable(String)' configuration factory method to create them. Consult the upgrading guide for further information: https://docs.gradle.org/8.5/userguide/upgrading_version_8.html#depending_on_root_configuration
The freeBazaarAlphaUnitTestRuntimeClasspathCopy configuration has been deprecated for consumption. This will fail with an error in Gradle 9.0. For more information, please refer to https://docs.gradle.org/8.5/userguide/declaring_dependencies.html#sec:deprecated-configurations in the Gradle documentation.
While resolving configuration 'freeBazaarAlphaUnitTestRuntimeClasspathCopy', it was also selected as a variant. Configurations should not act as both a resolution root and a variant simultaneously. Depending on the resolved configuration in this manner has been deprecated. This will fail with an error in Gradle 9.0. Be sure to mark configurations meant for resolution as canBeConsumed=false or use the 'resolvable(String)' configuration factory method to create them. Consult the upgrading guide for further information: https://docs.gradle.org/8.5/userguide/upgrading_version_8.html#depending_on_root_configuration
The dependency resolution engine wasn't able to find a version of module androidx.compose.ui:ui-test which satisfied all requirements because the graph wasn't stable enough. The highest version was selected in order to stabilize selection.
Features available in a stable graph like version alignment are not guaranteed in this case.
The freeBazaarDebugAndroidTestCompileClasspathCopy configuration has been deprecated for consumption. This will fail with an error in Gradle 9.0. For more information, please refer to https://docs.gradle.org/8.5/userguide/declaring_dependencies.html#sec:deprecated-configurations in the Gradle documentation.
While resolving configuration 'freeBazaarDebugAndroidTestCompileClasspathCopy', it was also selected as a variant. Configurations should not act as both a resolution root and a variant simultaneously. Depending on the resolved configuration in this manner has been deprecated. This will fail with an error in Gradle 9.0. Be sure to mark configurations meant for resolution as canBeConsumed=false or use the 'resolvable(String)' configuration factory method to create them. Consult the upgrading guide for further information: https://docs.gradle.org/8.5/userguide/upgrading_version_8.html#depending_on_root_configuration
The dependency resolution engine wasn't able to find a version of module androidx.compose.ui:ui-test which satisfied all requirements because the graph wasn't stable enough. The highest version was selected in order to stabilize selection.
Features available in a stable graph like version alignment are not guaranteed in this case.
The freeBazaarDebugUnitTestCompileClasspathCopy configuration has been deprecated for consumption. This will fail with an error in Gradle 9.0. For more information, please refer to https://docs.gradle.org/8.5/userguide/declaring_dependencies.html#sec:deprecated-configurations in the Gradle documentation.
While resolving configuration 'freeBazaarDebugUnitTestCompileClasspathCopy', it was also selected as a variant. Configurations should not act as both a resolution root and a variant simultaneously. Depending on the resolved configuration in this manner has been deprecated. This will fail with an error in Gradle 9.0. Be sure to mark configurations meant for resolution as canBeConsumed=false or use the 'resolvable(String)' configuration factory method to create them. Consult the upgrading guide for further information: https://docs.gradle.org/8.5/userguide/upgrading_version_8.html#depending_on_root_configuration
The freeBazaarDebugUnitTestRuntimeClasspathCopy configuration has been deprecated for consumption. This will fail with an error in Gradle 9.0. For more information, please refer to https://docs.gradle.org/8.5/userguide/declaring_dependencies.html#sec:deprecated-configurations in the Gradle documentation.
While resolving configuration 'freeBazaarDebugUnitTestRuntimeClasspathCopy', it was also selected as a variant. Configurations should not act as both a resolution root and a variant simultaneously. Depending on the resolved configuration in this manner has been deprecated. This will fail with an error in Gradle 9.0. Be sure to mark configurations meant for resolution as canBeConsumed=false or use the 'resolvable(String)' configuration factory method to create them. Consult the upgrading guide for further information: https://docs.gradle.org/8.5/userguide/upgrading_version_8.html#depending_on_root_configuration
The freeBazaarReleaseUnitTestCompileClasspathCopy configuration has been deprecated for consumption. This will fail with an error in Gradle 9.0. For more information, please refer to https://docs.gradle.org/8.5/userguide/declaring_dependencies.html#sec:deprecated-configurations in the Gradle documentation.
While resolving configuration 'freeBazaarReleaseUnitTestCompileClasspathCopy', it was also selected as a variant. Configurations should not act as both a resolution root and a variant simultaneously. Depending on the resolved configuration in this manner has been deprecated. This will fail with an error in Gradle 9.0. Be sure to mark configurations meant for resolution as canBeConsumed=false or use the 'resolvable(String)' configuration factory method to create them. Consult the upgrading guide for further information: https://docs.gradle.org/8.5/userguide/upgrading_version_8.html#depending_on_root_configuration
The freeBazaarReleaseUnitTestRuntimeClasspathCopy configuration has been deprecated for consumption. This will fail with an error in Gradle 9.0. For more information, please refer to https://docs.gradle.org/8.5/userguide/declaring_dependencies.html#sec:deprecated-configurations in the Gradle documentation.
While resolving configuration 'freeBazaarReleaseUnitTestRuntimeClasspathCopy', it was also selected as a variant. Configurations should not act as both a resolution root and a variant simultaneously. Depending on the resolved configuration in this manner has been deprecated. This will fail with an error in Gradle 9.0. Be sure to mark configurations meant for resolution as canBeConsumed=false or use the 'resolvable(String)' configuration factory method to create them. Consult the upgrading guide for further information: https://docs.gradle.org/8.5/userguide/upgrading_version_8.html#depending_on_root_configuration

@ben-manes
Copy link
Owner

no idea. I have done very little Android development which is where variants come in, as they are not common for standard Java projects. If you are using the latest version of this plugin, it should honor the isCanBeResolved flag on the configuration, which might skip those?

@jvandort
Copy link
Contributor Author

jvandort commented Dec 29, 2023

@LloydBlv The While resolving configuration 'freeGoogleplayReleaseUnitTestCompileClasspathCopy', it was also selected as a variant. is a new error and points to some weird stuff going on.

Do you have a full reproducer for this?

The Corrupt serialized resolution result is a bug in gradle. Please submit an issue there with a full reproducer.

@ben-manes
Copy link
Owner

From #822, it may be that the corrupted dependency graph is due to Gradle 8.4's XML security change (an underlying SAXNotRecognizedException). As plugins like Android have transitive dependencies on an insecure old xml parser, you can workaround it by adding the following to your gradle.properties.

systemProp.javax.xml.parsers.SAXParserFactory=com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
systemProp.javax.xml.transform.TransformerFactory=com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl
systemProp.javax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl

@kvolkers
Copy link

From #822, it may be that the corrupted dependency graph is due to Gradle 8.4's XML security change (an underlying SAXNotRecognizedException). As plugins like Android have transitive dependencies on an insecure old xml parser, you can workaround it by adding the following to your gradle.properties.

systemProp.javax.xml.parsers.SAXParserFactory=com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
systemProp.javax.xml.transform.TransformerFactory=com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl
systemProp.javax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl

This did resolve the issue I was having in my project after updating from gradle 8.3 to 8.4, resulting in many unresolved version checks and Caused by: java.lang.RuntimeException: Problems reading data from Binary store in ... and Caused by: java.lang.IllegalStateException: Corrupt serialized resolution result. Cannot find selected component ... for constraint ... errors.

@jaredsburrows
Copy link
Collaborator

@ben-manes Would it be worth exploring automatically setting this in the plugin?

System.setProperty("javax.xml.parsers.SAXParserFactory", "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl")
System.setProperty("javax.xml.transform.TransformerFactory", "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl")
System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl")

@ben-manes
Copy link
Owner

I’m afraid it’s too unsafe to do that. If you are on another jdk, like IBM’s, it’s different implementation classes. Or someone might plugin a different implementation on purpose.

The master branch now includes a check and fails early with a descriptive warning. I think that will help, but is not released yet

@jvandort
Copy link
Contributor Author

jvandort commented Jul 8, 2024

If anybody comes across this thread due to Problems reading data from Binary store or Corrupt serialized resolution result errors, please post your reproducers to gradle/gradle#14220

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants