Compiling Umbrella Fails; Individual Apps Compile Fine

I hit a bit of an unexpected snag while working on an umbrella app. Each of my apps compiles individually just fine, but when I try to run mix deps.compile from the root of the umbrella, I get an error with one of my apps (named “countries”):

== Compilation error in file lib/resource.ex ==
** (CompileError) lib/resource.ex:2: module Ecto.Query is not loaded and could not be found

The file in question has this at its top:

defmodule Countries.Resource do
    import Ecto.Query, warn: false

I do have {:ecto, "~> 3.0"} in the country app’s mix file. And if I go into the app, I can compile it fine:

cd apps/countries
mix deps.compile

Can anyone shed some light on why this is problematic?

Thanks!

:wave:

Can you compile the country app with

cd apps/countries
mix compile

?

If some other app in your project depends on the country app then running mix deps.compile from the umbrella root would call “compile” in it.

Yes, He can. He said in his very last paragraph.

:wave:

Unlike mix compile, mix deps.compile does not compile the app – only its dependencies.

2 Likes

Yes, both mix compile and mix deps.compile work in my “countries” app.

Oh, wow, I haven’t seen the deps on that line.

I have no explanation for this, but now when I run the command, it works. Maybe something was stuck in cache and the “countries” app finally started seeing the ecto dependency.

I was having this exact issue yesterday with a new phoenix umbrella project. I tried everything but in the end deleting the _build directory was what fixed it for me.