Spotless issue 373: Cannot add a configuration with name 'classpath' as a configuration with that name already exists

Hi, I’d like to see if I could get some feedback from the gradle team (or someone else of course)
regarding ?
I believe this line:
Configuration config = project.getRootProject().getBuildscript().getConfigurations().detachedConfiguration(deps);
in spotless is causing the issue from the topic.
More info can be found in the github issue, including a stacktrace.
This is being called during task input calculation and fails occasionally due to the classpath configuration in the rootproject being created from multiple projects in parallel (I think).

So the question is, should this be thread-safe or is this a case of incorrect usage by reaching into the rootProject from other projects?
And of course any suggestions for fixing this or doing it in a more standard way?

Disclaimer: I haven’t taken much time to understand the codebase.

It seems there’s a race condition initializing the root project’s buildscript classpath. What’s the reason for wanting to create the detached configurations in the root project’s buildscript? Why not create them in the current project?

If you did

Configuration config = project.getConfigurations().detachedConfiguration(deps)

Instead of

Configuration config = project.getRootProject().getBuildscript().getConfigurations().detachedConfiguration(deps)

I’d assume any race conditions could be avoided since each thread would be mutating a separate project instance

Disclaimer: I’m not the maintainer of spotless, just a user who thinks it’s great but is having a hard time upgrading due to this intermittent error that (probably) not many other people are experiencing.
And I guess we’ll continue the discussion in gitlab

Perhaps clone the repo, apply my change, build it and give it a whirl locally and submit a patch if it works.