Oleg Nenashev
05/15/2025, 3:16 PMOleg Nenashev
05/15/2025, 3:26 PMFrank Riccobono
05/15/2025, 4:12 PMSlackbot
05/15/2025, 4:29 PMOleg Nenashev
05/30/2025, 6:05 AMOleg Nenashev
06/02/2025, 12:24 PMCallum Rogers
06/10/2025, 3:30 PMclasses testClasses etc) fully works
2. Enable CC using gradle properties _in warn mode_ on repos so that CC will work for compilation, just not save the cache state for everything other set of tasks
3. In each repo, specify the max number of allowed CC problems to be the current number of problems. Use this max number of problems as a ratchet to stop people adding new problems (ie stop the bleeding).
4. Automatically reduce this max allowed number of CC problems down as we fix issues
5. CC just works on workflows where everything is fixed
6. Eventually we work down to 0 issues on the whole ./gradlew build and we hard enforce configuration cache on that repo
However, this doesn’t work, as warn mode doesn’t do what we expect. warn mode is apparently only supposed to be used for diagnosing initial problems. If you use warn mode, the build will still go wrong or error on configuration cache issues:
We don’t recommend usingFrom the Gradle team herefor anything but initial configuration cache adoption attempts to see more issues at once.problems=warn
WithFrom here This has kind of stopped us in our tracks, as we can’t just always run in warn mode for all our repos and keep track of the problems. Is there any way to gradually enable configuration cache? Our options seem to be: • Hard enforce CC on each repo using the gradle property. However, this requires getting to completely fixed in each repo in all the plugins and workflows it uses. This will take us a very long time due to the scale of our Gradle plugins (built over the last 13 years - many are quite crusty). • Have our devs opt-in to CC by manually using, it is expected that your build might run incorrectly if there are problems detected.problems=warn
--configuration-cache. This feels like a non-starter to me. Devs shouldn’t have to worry about this and won’t necessarily know which tasks are CC supported or not. It doesn’t enable it in IntelliJ without another IntelliJ Plugin. We can’t stop CC problems from regressing.
Is there some other approach?no
06/18/2025, 11:30 AMVladimir Sitnikov
06/20/2025, 9:37 AMorg.gradle.api.tasks.diagnostics.internal.ConfigurationDetails is not publicly-available.
Any third-party task like dependencies would effectively duplicate ConfigurationDetails to support the configuration cache.
Is there a possibility to make ConfigurationDetails public? I would assume it could be a feature-reduced variation of Configuration.Vladimir Sitnikov
06/20/2025, 2:19 PMResolvedArtifact (coordinates + file) from a Configuration so it is compatible with configuration cache?
I see I can pass incoming.resolutionResult.rootComponent (which is Provider<ResolvedComponentResult>) as a task property, however, I do not see how could I fetch artifact file location from the ResolvedComponentResultVladimir Sitnikov
06/20/2025, 5:51 PMproject nor project.dependencies is compatible with CC:
val artifactResolutionResult = project.dependencies.createArtifactResolutionQuery()
.forComponents(requests.map { it.first })
.withArtifacts(MavenModule::class, MavenPomArtifact::class)
.execute()
val results = artifactResolutionResult.resolvedComponents
.associate { it.id to it.getArtifacts(MavenPomArtifact::class) }René
06/25/2025, 9:14 AMFileCollection mainRuntime = mainSourceSet.getRuntimeClasspath();
FileCollection testRuntime = testSourceSet.getRuntimeClasspath();
FileCollection testOnlyFiles = testRuntime.minus(mainRuntime);
test.doFirst(task -> test.environment("es.entitlement.testOnlyPath", testOnlyFiles.getAsPath()));
ideally I would want to replace the requirement for using test.doFirst by replacing it with
test.environment("es.entitlement.testOnlyPath", getProviderFactory().provider(() -> testOnlyFiles.getAsPath()));
Now in theory that works okay but it breaks as soon as we enable configuration cache and have artifact transforms in declared that are registered against configurations that include internal dependencies complaining about the expected jar to transform not yet available (well it did not build yet). My understanding is that with having those configurations declared as @InputFiles gradle understands its buildable and does handle it as expected. Given that environment is @Input we circumvent the buildable part I assume. In this case would you just keep the doFirst block as is or do you have another idea how to solve that properly?Vampire
06/26/2025, 3:05 PMabstract class MyTask : DefaultTask() {
@get:Input
abstract val foo: Property<String>
}
val bar by tasks.registering
val baz by tasks.registering(MyTask::class) {
foo = bar.map {
println("Calculating foo")
""
}
}
the value of foo should not be serialized to the CC entry, as it has a task dependency.
But obviously I forgot some detail. 😕Eli Graber
07/17/2025, 5:59 AMVladimir Sitnikov
07/21/2025, 4:18 PMCalculating task graph as configuration cache cannot be reused because environment variable 'AWS_ACCESS_KEY_ID' has changed.
Is there a way to avoid configuration cache invalidation when credentials change?Ivan CLOVIS Canet
07/21/2025, 8:13 PMval theirTask by tasks.registering {
aProperty = provider { someComplexInitialization() }
}
instead of
val theirTask by tasks.registering {
aProperty = someComplexInitialization()
}
?
With the configuration cache enabled, the task will be configured eagerly anyway if theirTask is in the task graph, so the provider {} does nothing. Or is provider {} only for declaring things outside of tasks?Alex Beggs
07/25/2025, 4:33 PMRobert Elliot
07/30/2025, 5:25 PMJonathing
08/19/2025, 12:11 PMObjectFactory#newInstance (or whatever the internal version of that is) with service injection support or does it try to build the class raw using the saved values. Asking because I am using a transient private field that stores an instance of Problems which is normally provided through service injection in constructor parameter or bean getter.Daniel Karapishchenko
08/22/2025, 7:40 PMtest for example) without actually running it?Ivan CLOVIS Canet
08/24/2025, 1:12 PMException in thread "DefaultSharedObjectDecoder reader thread" org.gradle.api.GradleException: Could not load the value of
field `collection` of `kotlin.collections.builders.SerializedCollection` bean found in
field `_byTask` of `org.jetbrains.kotlin.gradle.targets.js.nodejs.TasksRequirements` bean found in
field `tasksRequirements` of `org.jetbrains.kotlin.gradle.targets.js.npm.resolver.KotlinCompilationNpmResolution` bean found in
field `byCompilation` of `org.jetbrains.kotlin.gradle.targets.js.npm.resolved.KotlinProjectNpmResolution` bean found in
field `v` of `java.util.Collections$SingletonMap` bean found in field `projects` of `org.jetbrains.kotlin.gradle.targets.js.npm.resolved.KotlinRootNpmResolution` bean found in
field `__resolution__` of `org.jetbrains.kotlin.gradle.targets.js.npm.KotlinNpmResolutionManager$Parameters_Decorated` bean found in Gradle runtime.
at org.gradle.internal.serialize.graph.BeanPropertyExtensionsKt.readPropertyValue(BeanPropertyExtensions.kt:70)
at org.gradle.internal.serialize.beans.services.BeanPropertyReader.readFieldOf(BeanPropertyReader.kt:93)
…
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 53 out of bounds for length 4
at org.gradle.internal.serialize.codecs.core.jos.JavaObjectSerializationCodec.decode(JavaObjectSerializationCodec.kt:299)
at org.gradle.internal.serialize.graph.codecs.BindingsBackedCodec.decode(BindingsBackedCodec.kt:92)
* What went wrong:
Could not load the value of field `__npmResolutionManager__` of task `:jsPackageJson` of type `org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinPackageJsonTask`.
No build scan was generated, even though they are enabled.
From what I can tell, this was introduced by this commit, but I don't understand why.René
08/29/2025, 10:11 AMJavi
09/11/2025, 8:59 AMJendrik Johannes
09/19/2025, 10:27 AMgetEventsListenerRegistry().onTaskCompletion(myServie) (full example).
Are there any other hooks like that available? Ideally I would like to force my service to start before task execution (i.e. after CC was loaded) and not just when the first task has completed.LoremIpsum-42
09/23/2025, 8:54 AMtasks.clean {
doFirst {
delete(layout.projectDirectory.dir("node_modules"))
}
}
Which now fails with CC enabled, because it is a disallowed type - how do I write this in a CC compatible way?
https://docs.gradle.org/9.1.0/userguide/configuration_cache_requirements.html#config_cache:requirements:disallowed_types
mentions that I should replace
project.delete {} with FileSystemOperations.delete {}
but the latter one has to be injected on a task - is there a way to use it like:
providers.exec { }
to write something like:
providers.fs.delete(..)
or how do I replace that doFirst / doLast delete operation(s)?Jendrik Johannes
09/24/2025, 7:00 AMorg.gradle.unsafe.isolated-projects in VS Code? Currently they add an init script that causes issues like
':app' cannot access 'Project.tasks' functionality on another project ':'LoremIpsum-42
09/25/2025, 10:37 AM1 problem was found storing the configuration cache.
`- Task :models:migrateDocumentModels of type `org.gradle.api.DefaultTask`: cannot serialize Gradle script object references as these are not supported with the configuration cache.`
See <https://docs.gradle.org/9.1.0/userguide/configuration_cache_requirements.html#config_cache:requirements:disallowed_types>
That would be really helpful - I know the report has a hierarchical view, but that one has e.g. "this$0" which is not that helpful.
I've got this task at the moment, which does result in the problem found above (it calls a jar / javaexec task in a loop):
val docModelMigration: Configuration by configurations.creating
docModelMigration.isTransitive = false
dependencies {
docModelMigration(libs.tool.model.migration) {
artifact {
classifier = "jar-with-dependencies"
}
}
}
val models =
listOf(
"modelA",
"modelB"
)
val migrateDocumentModels =
tasks.register("migrateDocumentModels") {
val myModels = models.toMutableList()
val myWorkingDir = layout.projectDirectory.asFile
val classPathFiles =
files(
docModelMigration.files,
java.sourceSets.main
.get()
.resources.srcDirs,
)
doLast {
myModels.forEach { model ->
val theTask =
providers
.javaexec {
workingDir = myWorkingDir
classpath = classPathFiles
mainClass = "com.example.migration.MigratorCli"
args = listOf(model)
}
theTask.result.get().assertNormalExitValue()
println(
theTask.standardOutput.asText
.get()
.trim(),
)
}
}
}
Anyone an idea what is wrong here - I moved all those project refs (working dir, classpath file collections from the configuration) out of doLast { } but I am still missing something here, what I am doing wrong, hints appreciated, thx.LoremIpsum-42
09/25/2025, 1:07 PMdoLast { } action. As soon as I am calling a function defined in my build.gradle.kts, I am getting a CC violation. I could inline the whole code of that function, but I can't believe that is the correct solution.
How can I call such a function without triggering a violation? A sample would be, I just made the body as small as possible:
tasks.register("npmInstall2") {
doLast {
if (changeLabel()) {
println("changed")
}
}
}
fun changeLabel(): Boolean = false
Hints appreciated, thanks.LoremIpsum-42
10/10/2025, 12:37 PMproject.tasks.register("checkDependencies") {
val configurationsToCheck = mutableSetOf<Configuration>()
listOf("compileClasspath", extension.configuration.get()).forEach { configToCheck: String ->
configurationsToCheck += project.configurations[configToCheck]
}
doLast {
val snapshotDeps = mutableListOf<String>()
val resolvedDependencies = mutableSetOf<ResolvedDependency>()
configurationsToCheck.forEach { configToCheck: Configuration ->
configToCheck
.resolvedConfiguration.firstLevelModuleDependencies
.forEach { resolvedDependencies += it }
}
val sortedValues = resolvedDependencies.toMutableList()
sortedValues.sortWith(compareBy({ it.moduleGroup }, { it.moduleName }))
sortedValues.forEach { dep: ResolvedDependency ->
if (dep.moduleGroup.startsWith("com.example")) {
// body work
Logging.getLogger("com.example").quiet("Found $dep")
}
}
if (!snapshotDeps.isEmpty()) {
throw GradleException("Found snapshot dependency: ${snapshotDeps.joinToString(separator = "\n")}")
}
}
}
Which does look over the 1st level declared deps on the given configurations and searches for patterns which I don't want there - this fails with CC enabled and Gradle 9.
Anyone have some pointers (to the docs) / ideas how to get those info / task / work done in a CC compatible way? Thanks.Robert Elliot
10/20/2025, 4:06 PM