Skip to content

Show builds on JDK 17 how to use the 17 line - #27

Merged
abashev merged 2 commits into
mainfrom
abashev/the-17-line
Dec 1, 2026
Merged

abashev merged 2 commits into
mainfrom
abashev/the-17-line

Conversation

@abashev

@abashev abashev commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Before this PR

17.1.0, the first release of the 17 line (openjavaformat/open-java-format#293), is out, but every page says the formatter needs Java 21. A Gradle daemon on JDK 17 cannot load the 21.x plugin at all, and nothing says how a build on JDK 17 to 20 formats.

After this PR

  • Gradle plugin. A section "Builds on JDK 17": apply 17.x; it formats every file that javac 17 parses as the 21 release of the same minor version (17.1.0 as 21.1.2); syntax newer than Java 17 needs 21.x. 17.x has no native binary of its own, so openjavaformat.native.formatter.version names the 21 release whose binary the plugin runs. A Dependabot rule ignores the major updates of dev.openjavaformat*, which would offer 21.x. The intro links to the section.
  • Maven plugin. It runs on Java 17 from 2.27.0.3, and a section "Builds on JDK 17" names 17.x in its dependency, with the same kind of Dependabot rule for dev.openjavaformat:open-java-format.
  • Spotless. The Gradle part points a daemon on Java 17 to 20 at 17.x; the Maven part says to name 17.x as the version there.
  • Get started. The requirements name 17.x for the Gradle plugin, the Maven plugin and Spotless on Java 17 to 20.
  • zensical.toml. ojf_17_version and ojf_17_native_version, next to ojf_version.
  • follow-releases.yml. The hourly bump followed ojf_version alone, with the latest release, which a 17.x never is. It now also sets ojf_17_version to the newest published 17.x and ojf_17_native_version to the newest 21 release of that minor version. Each moves only to a higher version, and one commit names every version that moved.

Checked: the bump step, run against the real releases, keeps 21.1.2, 17.1.0 and 21.1.2 as they are; from 21.1.1, 17.0.9 and 21.0.1 it moves all three to them; and from versions above every release it moves none. zizmor finds nothing in the workflow. zensical build --clean --strict finds no issues, and the rendered pages show 17.1.0 and 21.1.2 in place of the variables. The commands on the pages were run against the published 17.1.0 on JDK 17: formatDiff with the Gradle plugin, both on the Gradle JVM and with the 21.1.2 native binary, spotless:check and spotless:apply with the Spotless Maven plugin 3.12.0, and check and format of fmt-maven-plugin 2.27.0.3 with 17.1.0: both checks pass on a file that 21.1.2 formatted and fail on an unformatted one, and both formatting goals give 21.1.2's output.

Possible downsides?

  • The Dependabot rules are not tried in a repository here; it follows Dependabot's documented ignore with update-types.

17.1.0 is out: the formatter and the Gradle plugin built for Java 17, which format every file that javac 17
parses as the 21 release of the same minor version does. The Gradle page gets a section on it: the plugin
version, the native binary through openjavaformat.native.formatter.version, and a Dependabot rule that keeps
a build on 17.x. Spotless and Get started name 17.x for Java 17 to 20. zensical.toml holds the 17 line's
version and its 21 release as variables of their own, which follow-releases.yml does not move.
The hourly bump followed ojf_version alone, with the latest release, which a 17.x never is. It now also sets
ojf_17_version to the newest published 17.x, and ojf_17_native_version to the newest 21 release of that minor
version, whose native binary the 17 line's Gradle plugin runs. Each moves only to a higher version, and one
commit names every version that moved.
@abashev
abashev merged commit 849ccc7 into main Dec 1, 2026
2 checks passed
@abashev
abashev deleted the abashev/the-17-line branch December 1, 2026 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant