A sbt plugin for checking Java code styles
Scala Java
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
project
src
.gitignore
.travis.yml
README.md
build.sbt
sonatype.sbt
version.sbt

README.md

sbt-jcheckstyle

A sbt plugin for checking Java code styles with checkstyle.

Usage

Add sbt-jcheckstyle plugin to your project/plugins.sbt, then run jcheckStyle task: project/plugins.sbt

addSbtPlugin("org.xerial.sbt" % "sbt-jcheckstyle" % "0.1.3")
# Check code style of java codes
$ sbt jcheckStyle

# Check code style of java test codes
$ sbt test:jcheckStyle

Run style check before compilation

Add the following sbt settings:

compile in Compile <<= (compile in Compile) dependsOn (jcheckStyle in Compile)
compile in Test <<= (compile in Test) dependsOn (jcheckStyle in Test)

Style configuration

To configure Java code style, edit jcheckStyleConfig setting. In default, it uses Google's Java style:

jcheckStyleConfig := "google" // or "facebook", "sun" or path to your checkstyle.xml

Here is the list of the available styles:

Or you can specify your own configuration:

jcheckStyleConfig := "checkstyle.xml"