You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Situation: Our build is using Gradles dependencyResolutionManagement feature to centralize repository configuration in a multi-project setup. This involves setting up the list of repositories in settings.gradle. Please note that declaring any repository in a subproject will make that subproject ignore the centralized configuration completely, which is why we set repositoriesMode = RepositoriesMode.FAIL_ON_PROJECT_REPOS.
Bug: When adding biome() to the spotless configuration, it will internally add mavenLocal() to the project temporarily to determine a suitable download directory. This sadly causes the Gradle validation to trip and crash the build with the following stack trace:
The exception is:
[...]
Caused by: org.gradle.api.InvalidUserCodeException: Build was configured to prefer settings repositories over project repositories but repository 'MavenLocal' was added by build file 'build.gradle'
at org.gradle.internal.management.DefaultDependencyResolutionManagement.repoMutationDisallowedOnProject(DefaultDependencyResolutionManagement.java:199)
at org.gradle.internal.ImmutableActionSet$SetWithFewActions.execute(ImmutableActionSet.java:285)
at org.gradle.api.internal.DefaultDomainObjectCollection.doAdd(DefaultDomainObjectCollection.java:262)
at org.gradle.api.internal.DefaultNamedDomainObjectCollection.doAdd(DefaultNamedDomainObjectCollection.java:125)
at org.gradle.api.internal.DefaultDomainObjectCollection.add(DefaultDomainObjectCollection.java:251)
at org.gradle.api.internal.artifacts.DefaultArtifactRepositoryContainer.access$101(DefaultArtifactRepositoryContainer.java:35)
at org.gradle.api.internal.artifacts.DefaultArtifactRepositoryContainer.lambda$new$0(DefaultArtifactRepositoryContainer.java:38)
at org.gradle.api.internal.artifacts.DefaultArtifactRepositoryContainer.addWithUniqueName(DefaultArtifactRepositoryContainer.java:101)
at org.gradle.api.internal.artifacts.DefaultArtifactRepositoryContainer.addRepository(DefaultArtifactRepositoryContainer.java:89)
at org.gradle.api.internal.artifacts.DefaultArtifactRepositoryContainer.addRepository(DefaultArtifactRepositoryContainer.java:84)
at org.gradle.api.internal.artifacts.dsl.DefaultRepositoryHandler.mavenLocal(DefaultRepositoryHandler.java:142)
at com.diffplug.gradle.spotless.RomeStepConfig.findDataDir(RomeStepConfig.java:216)
at com.diffplug.gradle.spotless.RomeStepConfig.resolveDownloadDir(RomeStepConfig.java:276)
at com.diffplug.gradle.spotless.RomeStepConfig.newBuilder(RomeStepConfig.java:242)
at com.diffplug.gradle.spotless.RomeStepConfig.createStep(RomeStepConfig.java:161)
at com.diffplug.gradle.spotless.JsonExtension.biome(JsonExtension.java:75)
at com.diffplug.gradle.spotless.JsonExtension.biome(JsonExtension.java:69)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at org.gradle.internal.metaobject.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:541)
at org.gradle.internal.metaobject.BeanDynamicObject.tryInvokeMethod(BeanDynamicObject.java:218)
at org.gradle.internal.metaobject.CompositeDynamicObject.tryInvokeMethod(CompositeDynamicObject.java:99)
at org.gradle.internal.extensibility.MixInClosurePropertiesAsMethodsDynamicObject.tryInvokeMethod(MixInClosurePropertiesAsMethodsDynamicObject.java:38)
at org.gradle.internal.metaobject.ConfigureDelegate.invokeMethod(ConfigureDelegate.java:65)
at build_bucleb6i2fo8z9yql3xzqbyv3$_run_closure19$_closure61.doCall$original(C:\AE2\Forge\build.gradle:424)
Here is a minimal build.gradle / settings.gradle to reproduce this problem:
build.gradle
plugins {
id 'com.diffplug.spotless' version '6.25.0'
}
spotless {
json {
biome()
}
}
We are currently working around this problem by avoiding biome() and manually constructing the step, configuring the downloadDir (we have to catch the exception when it tries to replace the non-existent step), and then adding the step.
What this would need in Spotless is either a different approach to selecting a download directory altogether, or at least the ability to customize the BiomeStepConfig before the step is actually created, without throwing exceptions.
Gradle or Maven version: Gradle 8.8
spotless version: 6.25.0
operating system and version: Windows 11
The text was updated successfully, but these errors were encountered:
…2187
Use the Gradle user home directory by default for the download directory for the biome executable.
Previously, the plugin tried to use Maven's home directory, which is not always accessible by a Gradle plugin.
According to the [Gradle docs](https://docs.gradle.org/current/kotlin-dsl/gradle/org.gradle.api.invocation/-gradle/get-gradle-user-home-dir.html),
the user home directory
> is used to cache downloaded resources, compiled build scripts and so on.
From that description, it seems to me to be the proper location for the biome executable.
Situation: Our build is using Gradles
dependencyResolutionManagement
feature to centralize repository configuration in a multi-project setup. This involves setting up the list of repositories in settings.gradle. Please note that declaring any repository in a subproject will make that subproject ignore the centralized configuration completely, which is why we setrepositoriesMode = RepositoriesMode.FAIL_ON_PROJECT_REPOS
.Bug: When adding
biome()
to the spotless configuration, it will internally addmavenLocal()
to the project temporarily to determine a suitable download directory. This sadly causes the Gradle validation to trip and crash the build with the following stack trace:The exception is:
Here is a minimal build.gradle / settings.gradle to reproduce this problem:
build.gradle
settings.gradle
We are currently working around this problem by avoiding
biome()
and manually constructing the step, configuring thedownloadDir
(we have to catch the exception when it tries to replace the non-existent step), and then adding the step.What this would need in Spotless is either a different approach to selecting a download directory altogether, or at least the ability to customize the BiomeStepConfig before the step is actually created, without throwing exceptions.
The text was updated successfully, but these errors were encountered: