liveBook · Manning

Application resource file

As explained in Elixir in Action, Third Edition

An application resource file is a plain-text Erlang-term file that describes an OTP application, including its metadata, modules, dependencies, and startup callback module.

An application resource file is a plain-text Erlang-term file that describes an OTP application. It records the application name, version, description, modules, dependencies, and optional startup callback module. Mix generates this file during compilation from project metadata and source modules, so it normally does not need to be written by hand. section 11.1.1

The resource connects project configuration to the running OTP system:

  • Mix receives application metadata and startup configuration from mix.exs, including the application name, version, dependencies, extra applications, and callback module. section 11.1.1
  • Compilation places the generated .app file with compiled .beam files in the application's ebin directory, commonly under _build/dev/lib/YourApp/ebin. section 11.1.6
  • Application.start/1 reads the resource, verifies dependencies, and invokes the callback module's start/2 function; ensure_all_started/2 starts missing dependencies recursively. section 11.1.3
  • System startup requires compiled modules, available .app files, BEAM load paths, and all required OTP applications. section 13.1

Generated application

Running mix new hello_world --sup creates a Mix project with an application callback module and an initially empty supervisor. Starting it with iex -S mix automatically starts hello_world and its dependencies; Application.started_applications/0 exposes the resulting set of running applications. section 11.1.1

iex(1)> Application.started_applications()
[
  {:iex, ~c"iex", ~c"1.15.0"},
  {:hello_world, ~c"hello_world", ~c"0.1.0"},    #1
  {:logger, ~c"logger", ~c"1.15.0"},
  {:mix, ~c"mix", ~c"1.15.0"},
  {:elixir, ~c"elixir", ~c"1.15.0"},
  {:compiler, ~c"ERTS  CXC 138 10", ~c"8.3"},
  {:stdlib, ~c"ERTS  CXC 138 10", ~c"5.0"},
  {:kernel, ~c"ERTS  CXC 138 10", ~c"9.0"}
]

Inspect the running application list to verify that the generated application has started alongside its OTP and Elixir dependencies. section 11.1.1

How Elixir in Action, Third Edition covers it

How deep it goes
Explains contents, generation, filesystem location, and startup behavior, but defers direct manual authoring.
Examples
Uses a hello_world Mix project, Application.started_applications/0, mix.exs, ebin directories, and compiled .app files.
What it assumes
Assumes familiarity with Mix projects and OTP applications while teaching resource contents and their role in startup.
What you can do after
Operate/configure Mix projects that generate application metadata and diagnose missing artifacts or dependencies during startup.
How it connects
Connects OTP applications with Mix, application dependencies, callback modules, supervision trees, and the BEAM runtime.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Elixir in Action, Third Edition. The section links point to the parts of the book it draws on.