30 sbt plugins in 15 minutes
- eugene yokota (@eed3si9n)
An sbt plugin for building Scala Web applications
> re-start %args% --- %jvmArgs%
Allows jslint to be used from within sbt.
By default linting occurs as part of your project’s test
task. Both src/main/assets/**/*.js
and src/test/assets/**/*.js
sources are linted.
Looks up scaladoc.
> man Traversable /:
[man] scala.collection.Traversable
[man] def /:[B](z: B)(op: (B ⇒ A ⇒ B)): B
[man] Applies a binary operator to a start value and all elements of this
collection, going left to right. Note: /: is alternate syntax for foldLeft;
z /: xs is the same as xs foldLeft z. Note: will not terminate for infinite-
sized collections. Note: might return different results for different runs,
unless the underlying collection type is ordered. or the operator is
associative and commutative.
sbt plugin adding support for source code formatting using Scalariform
ScalariformKeys.preferences := ScalariformKeys.preferences.value
.setPreference(AlignSingleLineCaseStatements, true)
.setPreference(DoubleIndentClassDeclaration, true)
.setPreference(PreserveDanglingCloseParenthesis, true)
plugin to run shell commands from within the sbt shell
> sh git status
# On branch master...
Growling sbt test results so you don’t have to
I know this because build.sbt knows this.
sourceGenerators in Compile <+= buildInfo
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion)
Generates
package hello
case object BuildInfo {
val name = "helloworld"
val version = "0.1-SNAPSHOT"
val scalaVersion = "2.9.2"
val sbtVersion = "0.12.0"
}
sbt plugin for generating scala.Tuple/Function related boilerplate code
[#def applyFunc[P1, R](input: Tuple1[P1], func: (P1) => R): R =
func(input._1)#
]
This expands to:
def applyFunc[P1, R](input: Tuple1[P1], func: (P1) => R): R =
func(input._1)
def applyFunc[P2, R](input: Tuple2[P2], func: (P2) => R): R =
func(input._2)
def applyFunc[P3, R](input: Tuple3[P3], func: (P3) => R): R =
func(input._3)
....
scalaxb is an XML data binding tool for Scala.
sourceGenerators in Compile <+= scalaxb in Compile
sbt plugin to create a unified API document across projects
> unidoc
...
[info] Generating Scala API documentation for main sources to /unidoc-sample/target/scala-2.10/unidoc...
[info] Scala API documentation generation successful.
Translates xml -> awesome. Maven-ish support for sbt
publishing Scala/Java projects to the Maven central
> publishSigned
> sonatypeRelease
fresh packages delivered from your sbt console
> bintray::changeCredentials
> bintray::whoami
> publish
Deploy fat JARs. Restart processes.
Pack your class files and all your dependencies into a single JAR file:
> assembly
creates native packages:
> stage
> universal:package-zip-tarball
> universal:package-xz-tarball
> universal:package-bin
> windows:package-bin
> windows:package-msi
> debian:package-bin
> rpm:package-bin
An easy-to-use sbt plugin for working with all Android projects
> android:package
sbt plugin to create a dependency graph for your project.
> dependency-graph
> dependency-tree
> dependency-license-info
SBT plugin that can check maven repositories for dependency updates
> dependency-updates
[info] Found 3 dependency updates for test-project
[info] ch.qos.logback:logback-classic : 0.8 -> 0.8.1 -> 0.9.30 -> 1.0.13
[info] org.scala-lang:scala-library : 2.9.1 -> 2.9.3 -> 2.10.3
[info] org.slf4j:slf4j-api : 1.6.4 -> 1.6.6 -> 1.7.5
clean Ivy2 cache
> show cleanCacheFiles
> cleanCache
> show cleanLocalFiles
> cleanLocal
> cleanCache "net.databinder.dispatch" % "dispatch-json4s"