sbt/sbt-java-formatter

Name: sbt-java-formatter

Owner: sbt

Description: null

Created: 2015-12-10 07:15:01.0

Updated: 2018-04-29 03:34:51.0

Pushed: 2018-04-28 08:03:50.0

Homepage: null

Size: 51

Language: Scala

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

sbt-java-formatter

Download Build Status

An sbt plugin for formating Java code. Ideas from this blog post and this maven plugin.

Use 0.3.0+ for sbt 1.0.0, and 0.2.0 for previous versions of sbt.

Usage
  1. Add the plugin to project/plugins.sbt:
btPlugin("com.lightbend.sbt" % "sbt-java-formatter" % JavaFormatterVersion)
  1. Prepare a formatting-java.xml using Eclipse or steal someone's settings.

  2. Profit!

There is one optional step, in case you want to name the file differently, in which case you can do so via:

vaFormattingSettingsFilename := "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:

y-example/project/formatting-java.xml
y-example/formatting-java.xml
roject/formatting-java.xml
ormatting-java.xml

Always defaulting at the “root” project's project/formatting-java.xml (and lastly to formatting-java.xml).

Contributing

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.

Maintained by

@bantonsson and/or @ktoso, at @lightbend

License

Apache v2


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.