SBT 作为 scala 领域的标准构建工具,许多常用的构建功能都被写成了插件的形式,在相应配置文件里进行所需插件的声明之后就可以直接使用其功能了。本文对个人使用过程中的一些插件进行了总结。
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.5.0")
EclipseKeys.createSrc := EclipseCreateSrc.Default + EclipseCreateSrc.Resource
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.6.0")
addSbtPlugin("com.earldouglas" % "xsbt-web-plugin" % "1.0.0")
tomcat(port=9099)
#for sevlet, not this plugin
libraryDependencies += "javax.servlet" % "javax.servlet-api" % "3.0.1" % "provided"
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.12.0")
#To set the name of the jar
assemblyJarName in assembly := "myjarname.jar"
#To skip the test during assembly,
test in assembly := {}
#To set an explicit main class
mainClass in assembly := Some("com.lb.MyMain")
addSbtPlugin("com.zavakid.sbt" % "sbt-one-log" % "1.0.0")
// oneLogSettings will add libDependencies and resolvers
lazy val yourProject = (project in file(".")).enablePlugins(SbtOneLog)
社区插件列表:
http://www.scala-sbt.org/release/docs/Community-Plugins.html