Use custom source sets and compile-only dependencies instead of reflection
Spotless supports many formatters, and they have many transitive dependencies. We write most integration code using reflection, so that we don't have to reconcile the conflicting transitive dependencies of every formatter we support.
An easier-to-use, but harder-to-setup method is to create a custom source set with compileOnly dependencies. e.g src/main/java-scalafmt. We're happy to accept piecemeal PR's which do this for any formatter that a contributor is interested in - no need to convert everything.
When contributing a PR of this sort, there is no need to worry about older versions of the formatter - we can always use the old reflection code to maintain support for these old versions if necessary.
Completed examples:
- ktlint #1012
- palantir-java-format https://github.com/diffplug/spotless/pull/1083/commits/0d83dca8cc087a2773d1202ccf84e58a54d65631
- sortPom #946
- ktfmt #1145
- diktat #1190
- scalafmt #1283
TODO: