I’m trying to write a custom Gradle (8.0, 8.1) task which will print out all of my JAR dependencies in a subproject.
So I’m doing this:
val deps by tasks.creating {
val files = configurations.runtimeClasspath.get()
}
This works OK; it puts the Configuration
object inside files
, but when I’m trying to get into the files like this:
val deps by tasks.creating {
val files = configurations.runtimeClasspath.get().files
}
all I’m getting is this error:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':server'.
> Failed to notify project evaluation listener.
> Cannot change dependencies of dependency configuration ':server:api' after it has been included in dependency resolution.
> Cannot change dependencies of dependency configuration ':server:api' after it has been included in dependency resolution.
> Cannot change dependencies of dependency configuration ':server:implementation' after it has been included in dependency resolution.
Does the .files
accessor really change anything in the dependency graph? Shouldn’t it be readonly? Is this a bug?
Normally it works for simple Gradle projects, but for some reason fails for a simple multi-project build script. Can you post some pointers on how to debug such problems?
Edit: I think it has something to do with Micronaut. I’ve disabled the Micronaut Gradle plugin and it worked.