Skip to content

configuration-cache is unstable #34911

@BenchmarkMode

Description

@BenchmarkMode

Current Behavior

configuration-cache=true randomly gets errors like this when compiling

C:\Users\JT\Documents\project\module\src\main\java\com\example\module\SomeClass.java:91: error: cannot access LoaderClass
ListenerType listeners = MainClass.getLoader().getListeners();
^
bad class file: C:\Users\JT.m2\repository\com\example\library\1.0.0\library-1.0.0.jar(/com/example/library/fresh/LoaderClass.class)
unable to access file: java.util.zip.ZipException: too many length or distance symbols
Please remove or make sure it appears in the correct subdirectory of the classpath.

This is just one of many errors, its basically a dice roll, corruptzipexception is also common

Expected Behavior

Shouldn't error out

Context (optional)

Project is a parent project of sub gradle projects (im not using modules i think?), the error in question is sub project B calling to class belonging to sub project A, but A is compiled first so there should be no issue and there never was before config cache enabled, parent build kts:

val pluginOrder = listOf(
    "ProjectA",
    "ProjectB"
)

tasks.register("buildAll") {
    description = "Builds all"

    var previous: TaskProvider<*>? = null

    pluginOrder.forEach { pluginName ->
        val projectRef = project(":$pluginName")
        val shadowTask = projectRef.tasks.named("shadowJar")

        previous?.let { shadowTask.configure { mustRunAfter(it) } }

        dependsOn(shadowTask)
        previous = shadowTask
    }
}

project B is able to call into project A classes because shadowJar is finalized by publishToMavenLocal in all subprojects, project B then just includes A from local maven repo

Gradle version

9.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    closed:unreproducibleUnable to reproduce with given information

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions