Search⌘ K
AI Features

Manage Dependencies

Understand how to define and manage dependencies in the mix.exs file for Elixir projects. Learn the roles of runtime and build-time dependencies, the use of :deps and :extra_applications keys, and how to configure your application for seamless dependency management within Phoenix.

We'll cover the following...

mix.exs

Any project’s mix.exs file has two main functions: defining a project’s metadata and managing its dependencies. Of the two, dependency management is by far the most common thing developers do, and it’s the most important for our purposes as well.

Three functions defined in mix.exs do all the work for us. The project/0 function returns a keyword list of metadata about the application:

Elixir
def project do
[
app: :islands_engine,
version: "0.1.0",
elixir: "~> 1.5",
start_permanent: Mix.env == :prod,
deps: deps()
]
end

The app name, version number, and Elixir version are pretty self-explanatory. start_permanent: starts the system in such a way that the BEAM will crash if the top-level supervisor crashes. This will be true for the production environment as well.

The deps: key holds a list of build-time dependencies on which this application depends. The value ...