Umbrella can't find app in directory that does not match :app name

I have an Umbrella Application. The application names themselves are name spaced, but the directories are not:

  • apps/api -> namespace_api
  • apps/store -> namespace_store

I am getting the following error when running iex -S mix from parent umbrella dir:

Could not start application api: could not find application file: api.app.

I am assuming thats because the app compiles to _build/dev/namespace_api, but iex is looking for _build/dev/api… is that right?

Is there a way to fix this?

2 Likes

Try renaming your app in the project function of the Mixfile module:

defmodule StuffAPI.Mixfile do
  use Mix.Project

  def project do
    [app: :api,
     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
  ...

I generated it using --module option

 mix new stuff --umbrella
 cd stuff/apps
 mix new api --module StuffAPI

EDIT. Sorry. I’ve just reread your question. I guees that wouldn’t work for you, since you want to keep the apps namespaced.

2 Likes

Currently the app name must be the directory name as well.

2 Likes

Thanks, for the replies @idi527 and @josevalim. I will bite the bullet and keep the app name and directory the same.

2 Likes