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
{{ message }}
Repository navigation
Support using Gradle projects as the dependency inputs #1901
I'm running into this as well. I've created a new rule in the same (gradle) project that I'd like to apply it which doesn't seem possible at the moment.
I guess this is an intended behavior of not using it?
Are you saying there already is such a spotless configuration and it's already possible to use Gradle projects as dependencies? Because if you are, it's not working for me. And I would really like to have this feature.
// TODO: This is a copy-paste from org.gradle.api.attributes.java.TargetJvmEnvironment which is added in Gradle 7.0, remove this once we drop support for Gradle 6.x.
// Add this attribute for resolving Guava dependency, see https://github.com/google/guava/issues/6801.
@bgaudiosi I'm running into this as well. I've created a new rule in the same (gradle) project that I'd like to apply it which doesn't seem possible at the moment.
I solved this problem by releasing a custom ruleset module to MavenLocal and using it.
@ntkoopman Sorry I wasn't aware of this "hidden" feature.
The move to detached configuration is a necessary move for Gradle 9. And making a detached configuration depending whether it's root project or not seems like a future thing to trip on.
I'm experimenting right now, and I think that using the existing DSL is a better way to approach this. In particular I'm eying to make customRuleSet to be able to be passed a dependency notation, e.g.
So no need to mess with the configurations, so less possible errors.
The following idea can't work today in spotless since there can be multiple tool ; each tool should be somewhat having their own configuration, so a named spotless can't do that. If each requested tool had their own configuration, how to name them automatically, this looks like a point of friction (among others).
Activity
Goooler commentedon Nov 23, 2023
Another workable way is using
spotlessconfiguration likedependencies { spotless("org.junit.jupiter:junit-jupiter:5.10.0") spotless(libs.jupiter) spotless(projects.b) ... }I guess this is an intended behavior of not using it?
bgaudiosi commentedon Jan 12, 2024
I'm running into this as well. I've created a new rule in the same (gradle) project that I'd like to apply it which doesn't seem possible at the moment.
RubixDev commentedon Mar 3, 2024
Are you saying there already is such a
spotlessconfiguration and it's already possible to use Gradle projects as dependencies? Because if you are, it's not working for me. And I would really like to have this feature.Goooler commentedon Mar 3, 2024
Not yet, it's a proposal. There are some issues related to reuse configurations:
spotless/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/GradleProvisioner.java
Lines 116 to 132 in a6d2e61
jisungbin commentedon Jul 5, 2024
I solved this problem by releasing a custom ruleset module to MavenLocal and using it.
ntkoopman commentedon Jun 5, 2025
It would be great to have a better solution, but as a workaround you can set up a substitution rule in Gradle:
configurations.all { resolutionStrategy.dependencySubstitution { substitute(module("my:ktlint-rules")).using(project(":ktlint-rules")) } } tasks.withType(com.diffplug.gradle.spotless.SpotlessTask::class) { dependsOn(":ktlint-rules:jar") } spotless { kotlin { ktlint().customRuleSets(listOf("my:ktlint-rules:+")) } }Goooler commentedon Jun 5, 2025
Yeah, this is great!
ntkoopman commentedon Jul 20, 2026
Unfortunately, this has stopped working with spotless 8.5.0, since it switched to a detachedConfiguration, which is not configurable (4f9de0f) @bric3
bric3 commentedon Jul 21, 2026
@ntkoopman Sorry I wasn't aware of this "hidden" feature.
The move to detached configuration is a necessary move for Gradle 9. And making a detached configuration depending whether it's root project or not seems like a future thing to trip on.
I'm experimenting right now, and I think that using the existing DSL is a better way to approach this. In particular I'm eying to make
customRuleSetto be able to be passed a dependency notation, e.g.So no need to mess with the configurations, so less possible errors.
The following idea can't work today in spotless since there can be multiple tool ; each tool should be somewhat having their own configuration, so a named
spotlesscan't do that. If each requested tool had their own configuration, how to name them automatically, this looks like a point of friction (among others).As of today, I think only ktlint can consume other artifacts.