Rebar3
By the Erlang/OTP and Rebar community
Rebar3 is a build tool for Erlang projects that compiles code, manages dependencies, runs tests, and packages releases, serving the same role for Erlang that tools like Cargo or Maven serve for Rust or Java. config file, replacing the ad…
Definition
Rebar3 is a build tool for Erlang projects that compiles code, manages dependencies, runs tests, and packages releases, serving the same role for Erlang that tools like Cargo or Maven serve for Rust or Java. It standardizes how Erlang applications declare dependencies and build configuration through a single rebar.config file, replacing the ad hoc scripts many teams previously relied on.
Overview
Rebar3 grew out of the original Rebar tool as a rewrite aimed at fixing longstanding pain points in Erlang dependency management, particularly the difficulty of reliably resolving and fetching third-party libraries. Before Rebar3, Erlang developers often managed dependencies manually or with ad hoc scripts, since the language's tooling had not caught up with the package-manager conventions already common in other ecosystems. Rebar3 introduced a consistent plugin architecture, a dependency-locking mechanism, and integration with the Hex package repository shared with the Elixir community. Mechanically, a Rebar3 project is defined by a rebar.config file listing dependencies, compiler options, and profiles for different build contexts such as test or production. Running rebar3 compile fetches and builds dependencies into a deterministic directory structure, while a generated rebar.lock file pins exact dependency versions for reproducible builds across machines. Rebar3 also drives common developer workflows directly: rebar3 eunit and rebar3 ct run unit and common tests, rebar3 dialyzer performs static type analysis, and rebar3 release assembles a deployable OTP release with a self-contained runtime, ready to ship to a production host without further manual assembly of the runtime environment. Among Erlang tooling, Rebar3 effectively has no serious rival; it succeeded an earlier, less capable version of itself and became the de facto standard endorsed by the Erlang/OTP team and the broader community. Its closest conceptual peer is Mix, the equivalent build tool for Elixir, and the two share underlying infrastructure since both languages compile to the same BEAM virtual machine and can pull packages from the same Hex registry, easing interoperability in mixed-language codebases. In practice, essentially every modern Erlang project, from small libraries to production services, uses Rebar3 for building, testing, and releasing. Its plugin system lets teams extend it with custom tasks, such as generating documentation or packaging Docker images, without modifying the core tool, and its release-building capability is commonly used to produce self-contained OTP releases for deployment to cloud or on-premises infrastructure across a wide range of operational environments. The main limitations are ecosystem-scale ones rather than technical flaws: Erlang's package ecosystem on Hex is considerably smaller than npm's or crates.io's, so Rebar3 sometimes surfaces gaps in available libraries rather than tooling problems. Teams working in mixed Erlang/Elixir codebases also need to understand how Rebar3 and Mix interoperate when dependencies cross language boundaries, which adds a small amount of configuration overhead compared to a single-language project relying on just one build tool for everything.
Key Features
- Manages Erlang project dependencies via a single rebar.config file
- Locks exact dependency versions with a generated rebar.lock file
- Fetches packages from the shared Hex repository used by Elixir
- Runs unit tests, common tests, and Dialyzer static analysis via built-in commands
- Builds self-contained OTP releases for deployment
- Supports a plugin architecture for custom build tasks
- Provides build profiles for different environments such as test or production