in_umbrella deps not necessary

So I have taken two separate Phoenix apps and added them as apps in a new Umbrella application. I have everything working, but I am confused by the ‘in_umbrella’ dependencies.

I am expecting that in order to use modules from either of the 2 applications in a 3rd application that I would need to add:

{ :app_1, in_umbrella: true },
{ :app_2, in_umbrella: true }

That is in :app_3 mix.exs deps section. However, without specifying those dependencies at all, I am still able to:

import App1.SomeModule
...
App1.SomeModule.somefunc()

Expected: App1.SomeModule not found
Actual: Compiles/runs as if it was added to dependencies

I am new to Elixir, so not sure if I’m missing something or if there is something wrong with my Umbrella config.

Thank you!

1 Like

If it works, it is rather by accident, you are depending on the fact there were already compiled or in an implicit ordering guarantee. To see failures, make sure you delete the _build directory in the umbrella root and then run mix test inside one of the umbrella children.

3 Likes

Hiya

It depends how you run the app, at the top level all code is available. If you enter the directory of one of the apps and then run something from there mix will need to be instructed to look in other umbrella apps to find the code.

Cheers,
Louis

1 Like

Interesting, okay thanks!

So basically if I run the app or compile from the top-level Umbrella project it won’t fail due to missing dependencies. That will only occur when running a specific application within the apps directory?

You guys rock!!

2 Likes