Add sbt-java-formatter-add-opens plugin#261
Conversation
- Adds alias for the `javafmt[Check][All]` commands - Launches a new `sbt <javafmt_command>` session and adds the required `-add-opens` flags From a user perspective, the commands now just work again on Java 17+. No need to set flags.
|
So to make the sbt java formatter plugin work out of the box on Java 17+, in your project you just have to change -addSbtPlugin("com.github.sbt" % "sbt-java-formatter" % "0.11.1")
+addSbtPlugin("com.github.sbt" % "sbt-java-formatter-add-opens" % "0.11.1")Magic 🪄 |
|
Tested locally with sbt 1 and sbt2. |
|
I will merge that and cut a milestone. |
|
This solution is not really great. Compile / unmanagedSources / inputFileStamps :=
(Compile / unmanagedSources / inputFileStamps).dependsOn(Compile / javafmt).value,
Test / unmanagedSources / inputFileStamps :=
(Test / unmanagedSources / inputFileStamps).dependsOn(Test / javafmt).value,I found a better approach and reverted this again in The new implementation fixes the underlying problem in the main plugin by launching That means the workaround is now transparent no matter how |
Just take a look at the change
README. Call me crazy, but I like that idea.javafmt[Check][All]commandssbt <javafmt_command>session and adds the required-add-opensflagsFrom a user perspective, the commands now just work again on Java 17+. No need to set flags.