0.3.0+ for sbt 1.0.0, and
0.2.0 for previous versions of sbt.
- Add the plugin to
addSbtPlugin("com.lightbend.sbt" % "sbt-java-formatter" % JavaFormatterVersion)
formatting-java.xmlusing Eclipse or steal someone's settings.
There is one optional step, in case you want to name the file differently, in which case you can do so via:
javaFormattingSettingsFilename := "my-little-formatting-settings.xml"
File search order in multi-module projects
The plugin runs under the assumption that in multi-module projects, the "deeper" projects may want to specialize their formatting. In other words, the plugin looks up the config file using the folowing order:
1. my-example/project/formatting-java.xml 2. my-example/formatting-java.xml 3. project/formatting-java.xml 4. formatting-java.xml
Always defaulting at the "root" project's
project/formatting-java.xml (and lastly to
Yes, we'll happily accept PRs to improve the plugin. Please note that your changes should not accidentally cause reformatting of entire codebases (i.e. by changing defaults etc).
Please note that the plugin is very rough around the edges. It, in its current form was good enough for its initial use case, and we decided to share it instead of keeping it to ourselfes.
@bantonsson and/or @ktoso, at @lightbend