当前位置: 首页 > 工具软件 > sbt-one-log > 使用案例 >

SBT 常用插件配置总结

韩朝斑
2023-12-01

        SBT 作为 scala 领域的标准构建工具,许多常用的构建功能都被写成了插件的形式,在相应配置文件里进行所需插件的声明之后就可以直接使用其功能了。本文对个人使用过程中的一些插件进行了总结。

  • Eclipse
//-----------project/plugins.sbt-----------
    addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.5.0")

//----------------build.sbt-----------------
    EclipseKeys.createSrc := EclipseCreateSrc.Default + EclipseCreateSrc.Resource


  • Idea
//-----------project/plugins.sbt-----------
    addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.6.0")

  • XSBT-WEB
//-----------project/plugins.sbt-----------
    addSbtPlugin("com.earldouglas" % "xsbt-web-plugin" % "1.0.0")


//----------------build.sbt-----------------
    tomcat(port=9099)

    #for sevlet, not this plugin
    libraryDependencies += "javax.servlet" % "javax.servlet-api" % "3.0.1" % "provided"

  • SBT-ASSEMBLY
//-----------project/plugins.sbt-----------
    addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.12.0")

//----------------build.sbt-----------------
    #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")


  • sbt-one-log
    addSbtPlugin("com.zavakid.sbt" % "sbt-one-log" % "1.0.0")

//----------------build.sbt-----------------
    // oneLogSettings will add libDependencies and resolvers
    lazy val yourProject = (project in file(".")).enablePlugins(SbtOneLog)


社区插件列表:

http://www.scala-sbt.org/release/docs/Community-Plugins.html





 类似资料: