SBT 22 On SOC-R Boats
   HOME

TheInfoList



OR:

sbt is an
open-source Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized sof ...
build tool for Scala and
Java Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's List ...
projects, similar to Apache's
Maven MAVEN is an American spacecraft orbiting Mars to study the loss of its atmospheric gases to space, providing insight into the history of the planet's climate and water. The spacecraft name is an acronym for "Mars Atmosphere and Volatile Evolu ...
and
Gradle Gradle is a build automation tool for multi-language software development. It controls the development process in the tasks of compilation and packaging to testing, deployment, and publishing. Supported languages include Java (as well as Kotli ...
. Its main features are: *Native support for
compiling In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs that ...
Scala code and integrating with many Scala test frameworks *Continuous compilation, testing, and
deployment Deployment may refer to: Engineering and software Concepts * Blue-green deployment, a method of installing changes to a web, app, or database server by swapping alternating production and staging servers * Continuous deployment, a software en ...
*Incremental testing and compilation, meaning only changed sources are re-compiled, only affected tests are re-run *Build descriptions written in Scala using a
DSL Digital subscriber line (DSL; originally digital subscriber loop) is a family of technologies that are used to transmit digital data over telephone lines. In telecommunications marketing, the term DSL is widely understood to mean asymmetric dig ...
*Dependency management using Coursier, which supports Maven-format repositories *Integration with the Scala REPL for rapid iteration and debugging *Support for mixed Scala/Java projects sbt is the ''de facto'' build tool in the Scala community, used, for example, by
Play Framework Play Framework is an open-source software, open-source web application framework which follows the model–view–controller (MVC) architectural pattern (computer science), architectural pattern. It is written in Scala (programming language), Sc ...
. Lightbend Inc., which managed sbt development in past years, has called sbt "arguably the best tool for building Scala projects", saying that its two most prominent features are
incremental compilation An incremental compiler is a kind of incremental computation applied to the field of compilation. Quite naturally, whereas ordinary compilers make a so-called clean build, that is, (re)build all program modules, an incremental compiler recompiles o ...
and an interactive shell. In continuous compilation mode, the Scala compiler is instantiated only once, which eliminates subsequent startup costs; source file changes are tracked so that only affected dependencies are recompiled. The interactive console allows modifying build settings on the fly and entering the Scala REPL along with all class files of the project. The popularity of the incremental compilation prompted Lightbend to extract this feature in the form of an independent component called Zinc.


History

Mark Harrah publicly announced sbt on 18 December 2008. It was initially an abbreviation that stood for "Simple Build Tool", but it is now known simply as "sbt".


Build files

An sbt build can be defined using a .sbt file Below is an example of build.sbt build definition: val scalaTest = "org.scalatest" %% "scalatest" % "3.2.14" val akkaVersion = "2.6.20" val akkaActor = "com.typesafe.akka" %% "akka-actor" % akkaVersion val akkaCluster = "com.typesafe.akka" %% "akka-cluster" % akkaVersion // Set the Scala version used by this build to 2.13.10. ThisBuild / scalaVersion := "2.13.10" ThisBuild / version := "0.1.0-SNAPSHOT" ThisBuild / organization := "com.example" lazy val root = (project in file(".")) .aggregate(helloCore) .dependsOn(helloCore) .settings( name := "Hello", // Add a single dependency, for tests. libraryDependencies += scalaTest % Test ) lazy val helloCore = (project in file("core")) .settings( name := "Hello Core", libraryDependencies += scalaTest % Test, // Add multiple dependencies. libraryDependencies ++= List(akkaActor, akkaCluster) )


Example use

sbt may be invoked for each build command, or it may enter interactive mode if no command is given. To clean build products of the current build: $ sbt clean Multiple commands may be used on the same line. To run a single test named "Foo" and then publish exported jars: $ sbt "testOnly Foo" publish


Extensibility and integration

The functionality of sbt can be extended through a plugin architecture. A dedicated website was set up for community contributed plugins, which cover various areas such as signing, packaging, publishing and releasing artifacts, connecting to other services such as blogs and databases, or integrating with other technologies such as deploying to the Android platform. There are plugins to automatically create project files for the
Eclipse An eclipse is an astronomical event that occurs when an astronomical object or spacecraft is temporarily obscured, by passing into the shadow of another body or by having another body pass between it and the viewer. This alignment of three ce ...
and
IntelliJ IDEA IntelliJ IDEA is an integrated development environment (IDE) written in Java (programming language), Java for developing computer software written in Java, Kotlin (programming language), Kotlin, Groovy (programming language), Groovy, and other ...
IDEs. On the other hand, an IntelliJ IDEA plugin allows the sbt console to be integrated into IDEA, and projects can choose to use sbt for building.


Comparisons

As with most software tools, sbt has found advocates and critics. sbt is often compared to
Apache Maven Maven is a build automation tool used primarily for Java projects. Maven can also be used to build and manage projects written in C#, Ruby, Scala, and other languages. The Maven project is hosted by the Apache Software Foundation, where it was ...
, which is a standard build tool in the Java world. In particular, the
domain-specific language A domain-specific language (DSL) is a computer language specialized to a particular application domain. This is in contrast to a general-purpose language (GPL), which is broadly applicable across domains. There are a wide variety of DSLs, ranging f ...
used for sbt build files is considered by some to be more cryptic than the pure declarative approach of Maven's
XML Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing arbitrary data. It defines a set of rules for encoding documents in a format that is both human-readable and machine-readable. T ...
files. (Some of this criticism may predate sbt's introduction of a more direct, macro-based syntax.)


Bootstrapped development

The sbt project is "bootstrapped" — it uses sbt to build itself, as many compilers also do, and it considers that
dogfooding Eating your own dog food or "dogfooding" is the practice of using one's own products or services. This can be a way for an organization to test its products in real-world usage using product management techniques. Hence dogfooding can act as qual ...
is a positive feature. To the
Debian Debian (), also known as Debian GNU/Linux, is a Linux distribution composed of free and open-source software, developed by the community-supported Debian Project, which was established by Ian Murdock on August 16, 1993. The first version of D ...
project, however, that is considered a
circular dependency In software engineering, a circular dependency is a relation between two or more modules which either directly or indirectly depend on each other to function properly. Such modules are also known as mutually recursive. Overview Circular depend ...
, that they try to minimize. As a result, sbt is not yet in Debian., includes conversation with an sbt developer.


See also

*
List of build automation software Build automation involves scripting or automating the process of compiling computer source code into binary code. Below is a list of notable tools associated with automating build processes. Make-based * GNU make, a make implementation with a ...


References


External links

*{{Official website Build automation Compiling tools Java development tools Scala (programming language) Free software programmed in Scala Software using the BSD license