Dependencies are preferably added using hex.pm (https://hex.pm/).
Tip
If an application doesn't yet exist in Hex, it is also possible to use a GitHub repository as a source.
To fetch a dependency from GitHub, instead of declaring the dependency with the {:httpoison, "~> 0.4"}
format, the following format is used:
The local filesystem may also be configured as a source for dependencies, as follows:
Once the dependencies are declared inside the mix.exs
file, there are Mix tasks to get, compile, and clean them. The dependencies are then fetched, and if these dependencies have more dependencies on themselves, Mix is smart enough to fetch them.
When compiling dependencies, Mix is also capable of figuring out whether any dependent application has its own dependencies and whether they need to be compiled.
Starting IEx with the –S
Mix loads the Mix environment inside IEx, and the application becomes accessible.
As shown in the Inspecting your system recipe, it is possible to get a list of running applications and check whether our dependency (and its own dependencies) are running. In the particular case of HTTPoison, automatic start is ensured by adding the atom representing the application name to the list under applications
([applications: [:logger, :httpoison]]
).