1. Global Settings

Global Settings 

Basic global configuration file 

Settings that should be applied to all projects can go in $HOME/.sbt/1.0/global.sbt (or any file in $HOME/.sbt/1.0 with a .sbt extension). Plugins that are defined globally in $HOME/.sbt/1.0/plugins/ are available to these settings. For example, to change the default shellPrompt for your projects:

$HOME/.sbt/1.0/global.sbt

shellPrompt := { state =>
  "sbt (%s)> ".format(Project.extract(state).currentProject.id)
}

You can also configure plugins globally added in $HOME/.sbt/1.0/plugins/build.sbt (see next paragraph) in that file, but you need to use fully qualified names for their properties. For example, for sbt-eclipse property withSource documented in https://github.com/sbt/sbteclipse/wiki/Using-sbteclipse, you need to use:

com.typesafe.sbteclipse.core.EclipsePlugin.EclipseKeys.withSource := true

Global Settings using a Global Plugin 

The $HOME/.sbt/1.0/plugins/ directory is a global plugin project. This can be used to provide global commands, plugins, or other code.

To add a plugin globally, create $HOME/.sbt/1.0/plugins/build.sbt containing the dependency definitions. For example:

addSbtPlugin("org.example" % "plugin" % "1.0")

To change the default shellPrompt for every project using this approach, create a local plugin $HOME/.sbt/1.0/plugins/ShellPrompt.scala:

import sbt._
import Keys._

object ShellPrompt extends AutoPlugin {
  override def trigger = allRequirements

  override def projectSettings = Seq(
    shellPrompt := { state =>
      "sbt (%s)> ".format(Project.extract(state).currentProject.id) }
  )
}

The $HOME/.sbt/1.0/plugins/ directory is a full project that is included as an external dependency of every plugin project. In practice, settings and code defined here effectively work as if they were defined in a project’s project/ directory. This means that $HOME/.sbt/1.0/plugins/ can be used to try out ideas for plugins such as shown in the shellPrompt example.