Coder Social home page Coder Social logo

sbt-java-formatter's Introduction

sbt-java-formatter

Download Build Status

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

Usage

  1. Add the plugin to project/plugins.sbt:
addSbtPlugin("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:

  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 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

sbt-java-formatter's People

Contributors

amailp avatar bantonsson avatar ktoso avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.