From Elixir documentation:
:applications
- all applications your application depends on at runtime. By default, this list is automatically inferred from your dependencies. Any extra Erlang/Elixir dependency must be specified in:extra_applications
. Mix and other tools use the application list in order to start your dependencies before starting the application itself.
:extra_applications
- a list of Erlang/Elixir applications that you want started before your application. For example, Elixir’s:logger
or Erlang’s:crypto
.
If the list for :applications
is automatically inferred, then what are some example scenarios when we should add an application to :applications
instead of :extra_applications
? and vice versa?
Our mix. exs defines two public functions: project , which returns project configuration like the project name and version, and application , which is used to generate an application file. There is also a private function named deps , which is invoked from the project function, that defines our project dependencies.
Starting applications Differently from other languages, Elixir does not have a main procedure that is responsible for starting your system. Instead, you start one or more applications, each with their own initialization and termination logic. When an application is started, the Application.
You can compile an elixir file using the elixirc command. This will create a . beam file in the current directory for each module defined in your file. If you start iex in this directory your modules from the file will be available. Here you can read more about this command in the official guides.
In the Mix Project (ITMP) is a local registered charity (no. 1161486) that provides youth and community services across Somerset. We are based in Wiveliscombe, Taunton Deane, and we endeavour to provide services that are accessible to all with a focus on youth work.
If you use applications
then no inference is done and extra_applications
are not considered. When applications
are not provided, they are set to something like this:
applications_inferred_from_deps ++ extra_applications
You use one or the other, but never both.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With