Search code examples
elixirelixir-mix

Exclude application in a mix project from startup


I have a dependency that starts an application, but I only want to use its modules and don't want its supervisor running. How do I exclude it from startup?

I have not found anything related to this in mans for app.start, run or in Mix.Project module


Solution

  • Specifying runtime is usually the right approach for most applications:

    {:some_dep, "~> 1.0.0", runtime: false}
    

    This causes the application supervision tree of the dependency to not get started with the rest of your application. But this still allows you to manually start it during runtime if you desire.

    When using app: false instead, the dependency's Application module isn't read at all so you can't even manually start it later.