Skip to content

Dependency management

tuncer edited this page Sep 14, 2012 · 4 revisions

Rebar can fetch and build projects from external sources.

It is assumed that these dependencies are available in source form and adhere to rebar conventions,
i.e. are rebar source projects.

Defining dependencies

Dependencies are defined in rebar.config by the tuple {deps, [Dependency1, Dependency2, ...]} which
contains a list of dependency definitions.

A dependency is defined by a triple {App, VsnRegex, Source} where:

  • 'App' specifies the OTP application name, either an atom or a string
  • 'VsnRegex' is a string containing a regular expression that must match the OTP application version string
  • 'Source' specifies the engine used to fetch the dependency along with an engine specific location:
    • {hg, Url, Rev} Fetch from mercury repository
    • {git, Url} Fetch from git repository
    • {git, Url, {branch, Branch}} Fetch from git repository
    • {git, Url, ""} == {git, Url, {branch, "HEAD"}} Fetch from git repository
    • {git, Url, {tag, Tag}} Fetch from git repository
    • {git, Url, Rev} Fetch from git repository
    • {bzr, Url, Rev} Fetch from a bazaar repository

Example

In rebar.config:

{deps, [
    {em, ".*", {git, "https://github.com/sheyll/erlymock.git"}},
    {nano_trace, ".*", {git, "https://github.com/sheyll/nano_trace.git", {branch, "feature/rebar-migration"}}},
    {mochiweb, "2.3.2", {git, "https://github.com/mochi/mochiweb.git", {tag, "v2.3.2"}}}
   ]}.
Clone this wiki locally