Dep application not found in umbrella app

Hi,

Is anyone else seeing this behaviour? I wonder if it’s desired behaviour or a bug…

I have an umbrella

/app/
     app1/
     app2/ # phoenix app, depending on phoenix_html and app1

When I cd into /app/app1 and mix test, I get
** (Mix) Could not start application phoenix_html: could not find application file: phoenix_html.app
I cd to /app/app2, run mix test there to ensure phoenix_html is present. Then I cd back, but the problem still exists…

Each umbrella app must declare it’s own dependencies properly. Only if you start things from the root folder all apps and their respective dependencies are started. If you run mix test only for one app, only this apps dependencies are started. So if aap1 depends on phoenix_html, then you should decplade that in it’s mix.exs.

1 Like

Did you generate your codebase with phx.new --umbrella?

If so, app1 should not have dependencies on phoenix_html since it should only contain contexts and persistence (ie Ecto) logic.

Do you happen to have a misplaced test module using html function?

2 Likes

It uses the build and deps path from the root, which I think is standard:

  def project do
    [   
      app: :app1,
      version: "0.0.1",
      build_path: "../../_build",
      config_path: "../../config/config.exs",
      deps_path: "../../deps",
      lockfile: "../../mix.lock",
      elixir: "~> 1.8",
      elixirc_paths: elixirc_paths(Mix.env),
      elixirc_options: [warnings_as_errors: true],
      start_permanent: Mix.env == :prod,
      aliases: aliases(),
      test_coverage: [tool: Coverex.Task],
      deps: deps()
    ]   
  end 

Also I’m pretty sure this worked on Elixir 1.7.4, and probably broke when I recently upgraded to 1.8.1

1 Like

Your tests are running from the umbrella/root directory?

The problem exists when I run tests from /apps/app1.

1 Like

And instead of mix test I can run MIX_ENV=test iex -S mix to get the error.

1 Like

What are your deps for app1?

I had a similar problem, it was fixed in Elixir 1.8.1

https://github.com/elixir-lang/elixir/issues/7930

Thank you, upgrading seems to fix the problem.

1 Like