spotless icon indicating copy to clipboard operation
spotless copied to clipboard

Support using Gradle projects as the dependency inputs

Open Goooler opened this issue 1 year ago • 5 comments

I'd finished Ktlint custom rule sets support in #1896, but it supports Maven coordinates only due to the limits of

https://github.com/diffplug/spotless/blob/0189f717ee13acdb00745bffa86c6ed4ede53ef2/lib/src/main/java/com/diffplug/spotless/JarState.java#L56-L59

We can extend this for Gradle local projects to be used as the inputs, not sure if this way works for Maven projects as well.

Goooler avatar Nov 22 '23 07:11 Goooler

Another workable way is using spotless configuration like

dependencies {
  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?

Goooler avatar Nov 23 '23 19:11 Goooler

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.

bgaudiosi avatar Jan 12 '24 19:01 bgaudiosi

Another workable way is using spotless configuration like

dependencies {
  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?

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.

RubixDev avatar Mar 03 '24 06:03 RubixDev

Not yet, it's a proposal. There are some issues related to reuse configurations:

https://github.com/diffplug/spotless/blob/a6d2e615556b7acbf570b581470570f1ea12cef2/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/GradleProvisioner.java#L116-L132

Goooler avatar Mar 03 '24 06:03 Goooler

@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.

jisungbin avatar Jul 05 '24 01:07 jisungbin