Umbrella Application Bondaries Issue on Elixir v1.11

Hello.

I am having looking forward to update my umbrella application codebase to elixir 1.11 but I keep getting warnings between my umbrella projects.

I see multiple people are reporting issues like this but I did not find any which talk about this problem on dependencies between umbrella apps.

I am getting warning like this (I masked the app and functions name) :


==> app1
Compiling 4 files (.ex)
warning: App2.function/1 defined in application :app2 is used by the current application but the current application does not depend on :app2. To fix this, you must do one of:

  1. If :app2 is part of Erlang/Elixir, you must include it under :extra_applications inside "def application" in your mix.exs

  2. If :app2 is a dependency, make sure it is listed under "def deps" in your mix.exs

  3. In case you don't want to add a requirement to :core, you may optionally skip this warning by adding [xref: [exclude: [App2]]] to your "def project" in mix.exs

  lib/rate.ex:90: App1.Foo.bar/1

But if we check deps inside mix.exs for app1 we will find the following:

defmodule App1.Mixfile do
  use Mix.Project

  def project do
    [
      app: :app1,
      version: "0.1.0",
      build_path: "../../_build",
      config_path: "../../config/config.exs",
      deps_path: "../../deps",
      lockfile: "../../mix.lock",
      elixir: "~> 1.4",
      build_embedded: Mix.env == :prod,
      start_permanent: Mix.env == :prod,
      deps: deps()
    ]
  end

  # Configuration for the OTP application
  #
  # Type "mix help compile.app" for more information
  def application do
    # Specify extra applications you'll use from Erlang/Elixir
    [extra_applications: [:logger],
      applications: [:amqp, :elixir_xml_to_map, :xml_builder, :erlsom, :timex] ++ applications(Mix.env),
      mod: {App1.Application, []}]
  end
  defp applications(:dev), do: [:exsync]
  defp applications(_), do: []

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

So :app2 is indeed declared in the dependencies.

My umbrella app looks like this

 ├── apps
 │   ├── app1
 │   |     └── mix.exs
 │   ├── app2
 |   |    └── mix.exs
 │   └── ...
 ├── config
 └── mix.exs

Can someone help me in this issue?

1 Like

The applications key is usually the culprit with these - try moving those dependencies to extra_applications (preferred - let the tooling calculate applications), or add :app2 to applications.

3 Likes

Awesome. Thank you!