Skip to content

Configuration cache failure in presence of libraries that have no JARs #100

@CLOVIS-AI

Description

@CLOVIS-AI

Expected and Results

When I run a build, I get:

* What went wrong:
Configuration cache state could not be cached: field `provider` of `org.gradle.internal.serialize.codecs.core.ProviderBackedFileCollectionSpec` bean found in field `__jarFiles__` of task `:tapmocCheckClassFileVersions` of type `tapmoc.task.TapmocCheckClassFileVersionsTask`: error writing value of type 'org.gradle.api.internal.provider.DefaultProvider'
> Could not resolve all files for configuration ':tapmocRuntimeDependencies'.
   > No variants of org.codehaus.groovy:groovy-all:3.0.22 match the consumer attributes:
       - Adhoc variant for org.codehaus.groovy:groovy-all:3.0.22:
           - Incompatible because this component declares a component, as well as attribute 'artifactType' with value 'pom' and the consumer needed a component, as well as attribute 'artifactType' with value 'jar'
           - Other compatible attributes:
               - Doesn't say anything about com.android.build.gradle.internal.attributes.VariantAttr (required 'release')
               - Doesn't say anything about its usage (required runtime)

The root cause is that org.codehaus.groovy:groovy-all:3.0.22 does not have a JAR.

Libraries that have no JARs, for example org.codehaus.groovy:groovy-all:3.0.22, should be ignored.

Related environment and versions

  • Gradle 9.4.1
  • Tapmoc 0.4.2

Reproduction steps

build.gradle.kts:

plugins {
    java
    id("com.gradleup.tapmoc") version "0.4.2"
}

// groovy-all 3.x is a POM-only artifact (no JAR published, only a BOM POM).
// The @pom suffix forces Gradle to resolve it as a POM-type artifact, reproducing
// how dev.gradleplugins:gradle-test-kit:8.11.1 declares it in its Maven POM:
//
//   <dependency>
//     <groupId>org.codehaus.groovy</groupId>
//     <artifactId>groovy-all</artifactId>
//     <version>3.0.22</version>
//     <type>pom</type>         <-- this
//     <scope>runtime</scope>
//   </dependency>
//
// Without @pom, Gradle treats the POM packaging as a BOM import and does not add
// groovy-all itself to the dependency graph. With @pom, Gradle creates an adhoc
// component with a single variant: artifactType=pom.
dependencies {
    runtimeOnly("org.codehaus.groovy:groovy-all:3.0.22@pom")
}

tapmoc {
    java(11)
    // checkDependencies() enables tapmocCheckClassFileVersions.
    // With it: fails at task execution (both with and without --no-configuration-cache).
    // Without it: task is disabled (SKIPPED), but still fails at configuration cache
    //             serialization because Gradle eagerly resolves task inputs.
    checkDependencies()
}

gradle.properties:

org.gradle.configuration-cache=true

Run ./gradlew build and you will get the error.

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions