Good evening, I created an umbrella project, and write the :amqp dependency on the top mix.exs file. Then some problems occur when I use mix clean and mix compile, here is the detais:
-
Elixir version: Elixir 1.15.7 (compiled with Erlang/OTP 26)
-
Erlang version: Erlang/OTP 26 [erts-14.1.1]
-
OS: Arch Linux x86_64
-
Current Behaviour:
mix new foo --umbrella
cd foo/apps
mix new bar
Then write amqp dependency on the root mix.exs file, and run mix deps.get
:
foo/mix.exs
defp deps do
[
{:amqp, "~> 3.3"}
]
end
Then define an module use AMQP in bar:
foo/apps/bar/lib/bar2.ex
defmodule Bar2 do
use AMQP
end
The first time run mix compile
it succeeded, but when I run mix clean
and mix compile
after, it will report error:
==> bar
Compiling 2 files (.ex)
error: module AMQP is not loaded and could not be found
lib/bar2.ex:2: Bar2 (module)== Compilation error in file lib/bar2.ex ==
** (CompileError) lib/bar2.ex: cannot compile module Bar2 (errors have been logged)
(elixir 1.15.7) expanding macro: Kernel.use/1
lib/bar2.ex:2: Bar2 (module)
If I put the amqp dependency on the bar’s mix.exs file there is no such errors. Is this way of writing depencencies on the top mix.exs wrong?