[Help] Behavior of ":only" option in lib's dependency when library is imported with ":env"

Quick question! Let this line be in app X’s dependency listing in mix.exs:

{:Y, "~> 1.0.0", env: Mix.env()},

And let this line be in library Y’s dependency listing in its own mix.exs:

{:Z, "~> 0.1.0", only: :local},

Is it correct to expect that Z will be retrieved with mix deps.get in X’s context when the environment is set to local? Or should I take any extra provisions to achieve that? I am facing this kind of scenario right now and I can’t get the compilation to succeed, with the following error:

** (Mix) Could not start application Z: could not find application file: Z.app 

Any help is appreciated! Thanks! :slight_smile:

Dependencies are always build in their prod environment. So z will not be a dependency of X unless explicitly specified in X’s mixfile.

1 Like

Got it! So the :env option only specifies the environment the dependency will run on, not be built on, it does make sense according to the definition. Thanks!