This plugin is available through the Gradle plugin exchange. This means that there are a few different usage scenarios listed below.
In your build.gradle
file add:
plugins {
id "com.github.hierynomus.scalariform" version "0.4.0"
}
In your build.gradle
file add:
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "gradle.plugin.com.hierynomus.gradle.plugins:scalariform-gradle-plugin:0.4.0"
}
}
apply plugin: "com.github.hierynomus.scalariform"
For each source set configured in your project, this plugin will add a format<SourceSetName>Scala
Scalariform task.
Furthermore the plugin will configure a formatAllScala
task that depends on all the configured Scalariform tasks.
You can configure the formatter using the following snippet:
plugins {
id "com.github.hierynomus.scalariform" version "0.4.0"
}
scalariform {
alignParameters = true
alignSingleLineCaseStatements = true
}
For a complete listing of all possible configuration options, please consult the Scalariform documentation.