diffplug / diffplug/spotless

Support build agnostic external plugin SPI with dynamic lookups

Open
#2,288 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
5.6k
Forks
559
Avg merge
1d 13h
Merged PRs (30d)
34

Description

Currently adding a [custom plugin](https://github.com/diffplug/spotless/blob/main/CONTRIBUTING.md#how-to-add-a-new-plugin-for-a-build-system) requires adaptations to the Maven/Gradle plugin as
a) [FormatterStepFactory](https://github.com/diffplug/spotless/blob/main/plugin-maven/src/main/java/com/diffplug/spotless/maven/FormatterStepFactory.java#L22) and
b) [FormatterFactory](https://github.com/diffplug/spotless/blob/main/plugin-maven/src/main/java/com/diffplug/spotless/maven/FormatterFactory.java#L52) or [FormatExtension](https://github.com/diffplug/spotless/blob/b2a2cbb8b6026397c0adb8cb8b3571e399276f9b/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/FormatExtension.java#L79)

are
a) not build system agnostic and
b) are not dynamically looked up

It would be beneficial to have a build-agnostic plugin SPI which allows to
a) load dependencies
b) pass configuration
c) dynamically lookup services from classpath (e.g. with https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/ServiceLoader.html)

For Maven the mechanism for adding additional classes to the plugin classpath is via [plugin dependencies](https://maven.apache.org/guides/mini/guide-configuring-plugins.html#Using_the_.3Cdependencies.3E_Tag). I hope that Gradle provides something similar.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.