Open bric3 opened 3 months ago
Ever task with a name containing autostyle
has been replaced by a version with spotless
with it. Looks like I never got around to updating it in the documentation.
Not sure about the error though. I will try to reproduce it.
Ah, I forgot I had this in my ./gradle/init.d
folder, not sure why it cause this issue though.
auto-apply-spotless
allprojects {
plugins.withType(JavaPlugin::class.java) {
plugins.withId("com.diffplug.spotless") {
tasks.findByName("spotlessApply")?.let { spotless ->
tasks.withType<JavaCompile> { // this causes the issue
finalizedBy(spotless)
}
}
}
// legacy plugin id
plugins.withId("com.diffplug.gradle.spotless") {
tasks.findByName("spotlessApply")?.let { spotless ->
tasks.withType<JavaCompile> {
finalizedBy(spotless)
}
}
}
}
}
Interesting. Maybe I can figure out why it’s causing the error. Though I don’t immediately see why it should be an issue.
Yep I don't see as well why it could be an issue there, these seem to be different tasks.
For now I disabled this in my init.d
which allows the project to be imported fine.
I cloned the repo, and I see this error when trying to build or when importing in IJ and this is very confusing because at first nothing looks wrong.
```shell $ ./gradlew build Type-safe project accessors is an incubating feature. Project accessors enabled, but root project name not explicitly set for 'buildSrc'. Checking out the project in different folders will impact the generated code and implicitly the buildscript classpath, breaking caching. > Configure project : Building: JSVG 1.5.0-SNAPSHOT JDK: /Users/brice.dutheil/.asdf/installs/java/corretto-17.0.10.7.1 Gradle: 8.3 Build jsvg-root FAILURE reason: org.gradle.internal.exceptions.LocationAwareException: Build file '/Users/brice.dutheil/opensource/jsvg/jsvg/build.gradle.kts' line: 11 Cannot change dependencies of dependency configuration ':jsvg:compileOnly' after it has been included in dependency resolution. Caused by: org.gradle.api.InvalidUserDataException: Cannot change dependencies of dependency configuration ':jsvg:compileOnly' after it has been included in dependency resolution. at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.preventIllegalMutation(DefaultConfiguration.java:1520) at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.validateMutation(DefaultConfiguration.java:1479) at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.lambda$validateMutationType$0(DefaultConfiguration.java:358) at org.gradle.internal.ImmutableActionSet$SingletonSet.execute(ImmutableActionSet.java:225) at org.gradle.api.internal.DefaultDomainObjectSet.assertMutableCollectionContents(DefaultDomainObjectSet.java:57) at org.gradle.api.internal.DefaultDomainObjectCollection.addLater(DefaultDomainObjectCollection.java:272) at org.gradle.api.internal.DelegatingDomainObjectSet.addLater(DelegatingDomainObjectSet.java:104) at org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.doAddProvider(DefaultDependencyHandler.java:218) at org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.doAdd(DefaultDependencyHandler.java:191) at org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.add(DefaultDependencyHandler.java:123) at org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.add(DefaultDependencyHandler.java:117) at org.gradle.kotlin.dsl.support.delegates.DependencyHandlerDelegate.add(DependencyHandlerDelegate.kt:53) at Build_gradle$1.invoke(build.gradle.kts:11) at Build_gradle$1.invoke(build.gradle.kts:10) at org.gradle.kotlin.dsl.ProjectExtensionsKt.dependencies(ProjectExtensions.kt:236) at Build_gradle.Cannot change dependencies of dependency configuration ':jsvg:compileOnly' after it has been included in dependency resolution.
After various trial and errors I found out that spotless was the culprit, and that it is required to add
skipSpotless = true
in properties.And running also run into the same issue.
Also, contributing mention an
autostyleCheck
task but it doesn't exist.