You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+27Lines changed: 27 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,7 @@ For available versions see [releases](https://github.com/sbt/sbt-java-formatter/
37
37
* The `javafmtRemoveUnusedImports` setting controls whether unused imports are removed (`true` by default).
38
38
* The `javafmtReflowLongStrings` setting controls whether long string literals are reflowed (`true` by default).
39
39
* The `javafmtFormatJavadoc` setting controls whether Javadoc comments are reformatted (`true` by default).
40
+
* The `javafmtFormatterCompatibleJavaVersion` setting selects which `google-java-format` runtime line to use (`21` by default).
40
41
* The `javafmtJavaMaxHeap` setting controls the maximum heap passed to the forked `google-java-format` JVM (`Some("256m")` by default).
41
42
42
43
This plugin requires sbt 1.3.0+.
@@ -66,6 +67,20 @@ To make the plugin launch the formatter with a different Java installation, set
66
67
67
68
If both are set, `sbt-javafmt.java.home` takes precedence.
68
69
70
+
The selected Java home must still be compatible with the `google-java-format` runtime line chosen by `javafmtFormatterCompatibleJavaVersion`.
71
+
72
+
This is useful if your build runs sbt on one JDK but needs to launch the formatter on another one. For example, you can keep sbt on Java 11 and still run the formatter on a newer JDK by setting `SBT_JAVAFMT_JAVA_HOME` or `-Dsbt-javafmt.java.home=...`.
- or point the formatter to a newer JDK via `SBT_JAVAFMT_JAVA_HOME` or `-Dsbt-javafmt.java.home=...`
120
+
94
121
`javafmtOptions` is still available for compatibility, but the preferred sbt-facing configuration is through the dedicated `javafmt...` settings above.
95
122
96
123
`JavaFormatterOptions.reorderModifiers()` currently has no effect in this plugin.
// Compile the plugin against the Java 11-compatible google-java-format API line; actual formatter execution uses a separately selected forked runtime.
0 commit comments