Support build agnostic external plugin SPI with dynamic lookups

Open
#2,288 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
30/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
java

Research direction

Start by reading CONTRIBUTING.md and the linked FormatterStepFactory, FormatterFactory, and FormatExtension entry points in the Maven and Gradle plugins. Compare how each currently adds custom plugins and investigate the ServiceLoader and Maven plugin-dependency references in the issue. Done means a build-agnostic SPI can load dependencies, accept configuration, and dynamically discover external services for both integrations.

Written by the indexing model from the issue text.

Description

enhancement

Currently adding a custom plugin requires adaptations to the Maven/Gradle plugin as
a) FormatterStepFactory and
b) FormatterFactory or FormatExtension

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. I hope that Gradle provides something similar.

Dominant language
Java
Stars
5.7k
Forks
560
Avg merge
1d 13h
Merged PRs (30d)
43

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from diffplug/spotless

All issues in diffplug/spotless

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.