Starting application from umbrella root mixfile

I’d like to start my logging application from the root Mixfile in my umbrella project since I want it to run for the entire project. However, including it in application/0 there doesn’t start the it up. Is there a way to do this, or do I need to add it as a dependency in each of the apps in my umbrella project?

2 Likes

I think you can’t do that. Instead, you can create a base application in apps and start your common dependencies there. This is because the build system does not compile/package umbrella project itself as a BEAM application, only it’s children.

Then, add a dependency to your base application from other umbrella apps in their respective mix.exs files like:

defp deps do
  [{:baseapp, in_umbrella: true}]
end

This will ensure that the baseapp and it’s dependencies (like Logger) will be started when your current app starts.

I believe this is by design to keep the root of umbrella project simple and clean. Otherwise it’d end up being god-like place where you’d dump everything you could not fit in other apps.

It’s a mix project, not an application in umbrella root.

5 Likes

That makes total sense, thanks for the detailed response!

:+1: indeed. Thanks for the clarification :slight_smile:

2 Likes

This is a 100% correct. We don’t want settings from the parent project to magically pop up in the apps inside apps. So the explicit dependency on a sibling app in the umbrella is the way to go!

4 Likes