Skip to content

0.13.1

Latest

Choose a tag to compare

@mkurz mkurz released this 30 Jul 20:14
v0.13.1
496208d

sbt-java-formatter 0.13.1 is cross-published for:

sbt Version Published
1.x
2.x

Highlights

This release adds support for preserving the existing modifier order in Java sources, upgrades the default Java 21 formatter runtime to google-java-format 1.36.1, and builds the sbt 2.x plugin against the final sbt 2.0.0 release.

Migration

No configuration changes are required. Modifier reordering remains enabled by default, matching the behavior of previous releases.

The formatter selected by javafmtFormatterCompatibleJavaVersion := 21 has been upgraded from google-java-format 1.35.0 to 1.36.1. Because formatter upgrades can produce formatting changes, consider running javafmtAll once and reviewing the result.

To preserve the existing modifier order, use:

ThisBuild / javafmtReorderModifiers := false

Disabling modifier reordering requires the Java 21 formatter runtime line because the Java 11 and Java 17 lines do not support the necessary --skip-reordering-modifiers CLI flag:

ThisBuild / javafmtFormatterCompatibleJavaVersion := 21

The formatter JVM must therefore run on Java 21 or newer. If sbt itself runs on an older JDK, point the formatter to a compatible JDK using SBT_JAVAFMT_JAVA_HOME or -Dsbt-javafmt.java.home=....

New

  • The new javafmtReorderModifiers setting controls whether google-java-format reorders modifiers into JLS order. It is enabled by default.
  • javafmtOptions.reorderModifiers(false) is now also honored, although the dedicated javafmtReorderModifiers sbt setting is preferred.
  • The Java 21 formatter runtime now uses google-java-format 1.36.1, which adds initial formatting support for Markdown documentation comments (///).
  • The sbt 2.x plugin is now built against the final sbt 2.0.0 release.

What's Changed

Full Changelog: v0.12.0...v0.13.1