1. Index

Index 

This is an index of common methods, types, and values you might find in an sbt build definition. For command names, see Running. For available plugins, see the plugins list.

Values and Types 

Dependency Management 

  • ModuleID is the type of a dependency definition. See Library Management.
  • Artifact represents a single artifact (such as a jar or a pom) to be built and published. See Library Management and Artifacts.
  • A Resolver can resolve and retrieve dependencies. Many types of Resolvers can publish dependencies as well. A repository is a closely linked idea that typically refers to the actual location of the dependencies. However, sbt is not very consistent with this terminology and repository and resolver are occasionally used interchangeably.
  • A ModuleConfiguration defines a specific resolver to use for a group of dependencies.
  • A Configuration is a useful Ivy construct for grouping dependencies. See ivy-configurations. It is also used for scoping settings.
  • Compile, Test, Runtime, Provided, and Optional are predefined configurations.

Settings and Tasks 

  • A Setting describes how to initialize a specific setting in the build. It can use the values of other settings or the previous value of the setting being initialized.
  • A SettingsDefinition is the actual type of an expression in a build.sbt. This allows either a single Setting or a sequence of settings (SettingList) to be defined at once. The types in a .scala build definition always use just a plain Setting.
  • Initialize describes how to initialize a setting using other settings, but isn’t bound to a particular setting yet. Combined with an initialization method and a setting to initialize, it produces a full Setting.
  • TaskKey, SettingKey, and InputKey are keys that represent a task or setting. These are not the actual tasks, but keys that are used to refer to them. They can be scoped to produce ScopedTask, ScopedSetting, and ScopedInput. These form the base types that provide the Settings methods.
  • InputTask parses and tab completes user input, producing a task to run.
  • Task is the type of a task. A task is an action that runs on demand. This is in contrast to a setting, which is run once at project initialization.

Build Structure 

Methods 

Settings and Tasks 

See the Getting Started Guide for details.

  • :=, +=, ++= These construct a Setting, which is the fundamental type in the settings system.
  • value This uses the value of another setting or task in the definition of a new setting or task. This method is special (it is a macro) and cannot be used except in the argument of one of the setting definition methods above (:=, …) or in the standalone construction methods Def.setting and Def.task. See Task-Graph for details.
  • in specifies the Scope or part of the Scope of a setting being referenced. See scopes.

File and IO 

See RichFile, PathFinder, and Paths for the full documentation.

  • / When called on a single File, this is new File(x,y). For Seq[File], this is applied for each member of the sequence..
  • * and ** are methods for selecting children (*) or descendants (**) of a File or Seq[File] that match a filter.
  • |, ||, &&, &, -, and -- are methods for combining filters, which are often used for selecting Files. See NameFilter and FileFilter. Note that methods with these names also exist for other types, such as collections (like Seq) and Parser (see Parsing Input).
  • pair Used to construct mappings from a File to another File or to a String. See Mapping Files.
  • get forces a PathFinder (a call-by-name data structure) to a strict Seq[File] representation. This is a common name in Scala, used by types like Option.

Dependency Management 

See Library Management for full documentation.

  • % This is used to build up a ModuleID.
  • %% This is similar to % except that it identifies a dependency that has been cross built.
  • from Used to specify the fallback URL for a dependency
  • classifier Used to specify the classifier for a dependency.
  • at Used to define a Maven-style resolver.
  • intransitive Marks a dependency or Configuration as being intransitive.
  • hide Marks a Configuration as internal and not to be included in the published metadata.

Parsing 

These methods are used to build up Parsers from smaller Parsers. They closely follow the names of the standard library’s parser combinators. See Parsing Input for the full documentation. These are used for Input Tasks and Commands.

  • ~, ~>, <~ Sequencing methods.
  • ??, ? Methods for making a Parser optional. ? is postfix.
  • id Used for turning a Char or String literal into a Parser. It is generally used to trigger an implicit conversion to a Parser.
  • |, || Choice methods. These are common method names in Scala.
  • ^^^ Produces a constant value when a Parser matches.
  • +, * Postfix repetition methods. These are common method names in Scala.
  • map, flatMap Transforms the result of a Parser. These are common method names in Scala.
  • filter Restricts the inputs that a Parser matches on. This is a common method name in Scala.
  • - Prefix negation. Only matches the input when the original parser doesn’t match the input.
  • examples, token Tab completion
  • !!! Provides an error message to use when the original parser doesn’t match the input.