Dependencies

This is a mixed bag, as some of these tools also come with package lists/package management built in.

Configuration

Rebar

Access to resources from various locations is handled via custom rebar resources. Included with rebar3 are rebar_git_resource, rebar_hg_resource and rebar_pkg_resource.

Dependencies from a package index

hex.pm packages

{deps,[
  %% Packages
  rebar,
  {rebar,"1.0.0"},
  {rebar, {pkg, rebar_fork}}, % rebar app under a different pkg name
  {rebar, "1.0.0", {pkg, rebar_fork}}
]}.

Dependencies from a repository

{deps,[
  %% Source Dependencies
  {rebar, {git, "git://github.com/rebar/rebar3.git"}},
  {rebar, {git, "http://github.com/rebar/rebar3.git"}},
  {rebar, {git, "https://github.com/rebar/rebar3.git"}},
  {rebar, {git, "[email protected]:rebar/rebar3.git"}},
  {rebar, {hg, "https://othersite.com/rebar/rebar3"}},
  {rebar, {git, "git://github.com/rebar/rebar3.git", {ref, "aef728"}}},
  {rebar, {git, "git://github.com/rebar/rebar3.git", {branch, "master"}}},
  {rebar, {git, "git://github.com/rebar/rebar3.git", {tag, "3.0.0"}}},
  %% Legacy support -- added parts are ignored
  {rebar, "3.*", {git,"git://github.com/rebar/rebar3.git"}},
  {rebar, {git, "git://github.com/rebar/rebar3.git"}, [raw]},
  {rebar, "3.*", {git, "git://github.com/rebar/rebar3.git"}, [raw]}
]}.

Local dependencies

Stored or symlinked in _checkouts directory. Any dependency in this directory will be automatically processed by rebar3. See more.

erlang.mk

erlang.mk can pull dependencies specified in it's package list or from Git repositories. Other package lists and repository types may be available via plugins.

Dependencies from a package index

erlang.mk's package index

DEPS = <package_name>

For example:

DEPS = cowboy

Dependencies from a repository

DEPS = <name_1> <name_2> ...
dep_name_1 = git <url> <tag_or_hash>
dep_name_2 = git <url> <tag_or_hash>
...

For example:

DEPS = hackney jiffy

dep_hackney = git https://github.com/benoitc/hackney fd706efd73c2c906
dep_jiffy = git https://github.com/davisp/jiffy 0.14.4

Local dependencies

Any local directory in the deps folder will be automatically processed by erlang.mk. If these are OTP application folders and you want them included in the generated .app file, you need to define the LOCAL_DEPS variable for each relevant application. See more.

mix

mix retrieves dependencies from hex.pm or from Git repositories. Other package lists and repository types may be available via plugins.

Dependencies from a package index

hex.pm package index

def deps do
  [{:plug, "~> 1.0"}]
end

Dependencies from a repository

def deps do
  [{:plug, git: "git://github.com/elixir-lang/plug.git"}]
end

Local dependencies

def deps do
  [{:foobar, path: "path/to/foobar"}]
end

Fetch and compile

rebar3

rebar3 fetches and compiles dependencies when it compiles the entire app. There are no separate steps to fetch, compile, recompile or clean dependencies.

rebar compile

erlang.mk

erlang.mk can fetch and compile dependencies in a separate step. There are no separate steps to recompile or clean dependencies.

make deps

mix

mix has separate steps for fetching, compiling, cleaning dependencies. Refer to documentation or inline help for more info

mix deps
mix deps.clean
mix deps.compile
mix deps.get
mix deps.unlock
mix deps.update