Description
Problem
dev.openjavaformat:fmt-maven-plugin is spotify's fmt-maven-plugin with the formatter swapped: package com.spotify.fmt, MIT licence, JUnit 4, maven.version 3.10.0. Its fork mode launches ${java.home}/bin/java (ForkingExecutor), the JVM Maven itself runs on, so Maven must run on Java 21. There is no up-to-date checking, no changed-lines mode, no toolchain support and no m2e lifecycle mapping.
For ASF Maven this is the blocking gap: 20+ apache repos take the formatter from maven-parent through spotless-maven-plugin, and Spotless has no step for open-java-format (see the Spotless issue). A plugin that can sit next to Spotless in process-sources is the alternative route.
Proposed shape: open-java-format-maven-plugin
- Own package and Apache-2.0 header, maven-plugin-tools annotations, Maven 3.9 and 4.0 (CI through the shared Maven verify workflow, 3.10 matrix plus 4.x).
- Goals
checkandapply;--linesmode from a git ref for changed lines only. - Content-hash up-to-date index like Spotless's
upToDateChecking. - Formatter execution decoupled from the build JVM: toolchain-selected JDK through the existing
BootstrappingFormatterService(jdkPath, …)in-jdk-bootstrap, or the native binary. This is what lets a build on JDK 17 or 8 run a formatter that needs 21. - m2e lifecycle mapping,
skipproperty, file sets with include/exclude, parallel formatting. - Coexists with Spotless for
licenseHeader,importOrder,removeUnusedImportsandsortPom: declare it before Spotless in the same phase (maven-parent already carries the ordering comment, MPOM-376).
Evidence
Measured 2026-11-03 on apache/maven master (2104 Spotless-covered sources, clean under spotless:check, maven-parent 50 pins pjf 2.98.0): open-java-format 21.0.1 with --skip-reflowing-long-strings --skip-sorting-imports --skip-removing-unused-imports changes 7 files, all the switch-expression-initializer shape pjf itself introduced in 2.99.0 (palantir#1789). google-java-format 2.0.0 --aosp --max-line-length=120 with the same skips rewrites 814 files. So OJF is a drop-in for the ASF baseline; the plugin is the only missing piece.
Activity