All Projects → sbt → sbt-java-formatter

sbt / sbt-java-formatter

Licence: Apache-2.0 license
An sbt plugin for formating Java code

Programming Languages

scala
5932 projects
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to sbt-java-formatter

Converter
Typescript to Scala.js converter
Stars: ✭ 168 (+572%)
Mutual labels:  sbt
typelevel-stack.g8
📚 Unofficial Giter8 template for the Typelevel Stack (Http4s / Doobie / Circe / Cats Effect / Fs2) based on Cats v1.x.x
Stars: ✭ 63 (+152%)
Mutual labels:  sbt
sbt-travisci
An sbt plugin to integrate with Travis CI
Stars: ✭ 44 (+76%)
Mutual labels:  sbt
sbt-graphql
SBT plugin to generate and validate graphql schemas written with Sangria
Stars: ✭ 94 (+276%)
Mutual labels:  sbt
sbt-findbugs
FindBugs static analysis plugin for sbt.
Stars: ✭ 47 (+88%)
Mutual labels:  sbt
sbt-swagger-2
sbt plugin for generating Swagger JSON schemas during build
Stars: ✭ 13 (-48%)
Mutual labels:  sbt
sbt-sass
A fork of the sbt-sass repository which seems to be abandoned.
Stars: ✭ 32 (+28%)
Mutual labels:  sbt
akka-stream-kafka-template.g8
Template for Akka Streams & Kafka. Default impl: mirror a topic onto another one
Stars: ✭ 14 (-44%)
Mutual labels:  sbt
awesome-python-code-formatters
A curated list of awesome Python code formatters
Stars: ✭ 168 (+572%)
Mutual labels:  code-formatter
sbt-spark-submit
sbt plugin for spark-submit
Stars: ✭ 94 (+276%)
Mutual labels:  sbt
scalarr
A command-line client for Sonarr, written in Scala
Stars: ✭ 33 (+32%)
Mutual labels:  sbt
cassandra-phantom
Cassandra + Phantom Example
Stars: ✭ 64 (+156%)
Mutual labels:  sbt
sbt-eviction-rules
An sbt plugin enhancing the evicted key.
Stars: ✭ 20 (-20%)
Mutual labels:  sbt
akka-http-docker-sample
example of running an Sbt application in Docker based on openjdk:jre-alpine
Stars: ✭ 20 (-20%)
Mutual labels:  sbt
sbt-project-switcher
A sbt plugin to switch project in a snappy way⚡️
Stars: ✭ 36 (+44%)
Mutual labels:  sbt
sliding-puzzle
Sliding puzzle game implemented in Scala / Scala.js / JavaFX
Stars: ✭ 25 (+0%)
Mutual labels:  sbt
gatling-sbt-plugin
Gatling Plugin for SBT
Stars: ✭ 105 (+320%)
Mutual labels:  sbt
spark-spray-starter
No description or website provided.
Stars: ✭ 16 (-36%)
Mutual labels:  sbt
sbt-bazel
Easily convert SBT projects to Bazel workspaces
Stars: ✭ 55 (+120%)
Mutual labels:  sbt
sbt-rewarn
Make sbt always display compilation warnings, even for unchanged files.
Stars: ✭ 42 (+68%)
Mutual labels:  sbt

sbt-java-formatter scaladex-badge

An sbt plugin for formatting Java code. This plugin began as a combination of ideas from this blog post and this maven plugin, though it has evolved since.

Usage

Add the plugin to project/plugins.sbt:

addSbtPlugin("com.lightbend.sbt" % "sbt-java-formatter" % --latest version---)

For available versions see releases.

  • javafmt formats Java files

  • javafmtAll formats Java files for all configurations (Compile and Test by default)

  • javafmtCheck fails if files need reformatting

  • javafmtCheckAll fails if files need reformatting in any configuration (Compile and Test by default)

  • The javafmtOnCompile setting controls whether the formatter kicks in on compile (false by default).

  • The javafmtStyle setting defines the formatting style: Google Java Style (by default) or AOSP style.

This plugin requires sbt 1.3.0+.

Enable in other scopes (eg IntegrationTest)

The sbt plugin is enabled by default for the Test and Compile configurations. Use JavaFormatterPlugin.toBeScopedSettings to enable the plugin for the IntegrationTest scope and then use It/javafmt to format.

inConfig(IntegrationTest)(JavaFormatterPlugin.toBeScopedSettings)

Configuration

This plugin uses the Google Java Format library, which makes it quite opinionated and not particularly configurable.

If you want to tweak the format, take a minute to consider whether it is really worth it, and have a look at the motivations in the Google Java Style Guide. If you decide you really need more flexibility, you could consider other plugins such as the sbt-checkstyle-plugin

Contributing

Yes, we'll happily accept PRs to improve the plugin. We expect you to adhere to the Lightbend Community Code of Conduct and to sign the Lightbend Contributor License Agreement - CLA.

Take a look at the contributors graph if you want to contact any of the contributors directly.

License

Apache v2

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].