Hey guys,
I’m getting an issue when generating a release:
warning: MyDep.MyDepMod.helper/1 defined in application :my_dep is used by the current application but the current application does not depend on :my_dep. To fix this, you must do one of:
1. If :my_dep is part of Erlang/Elixir, you must include it under :extra_applications inside "def application" in your mix.exs
2. If :my_dep 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 :my_dep, you may optionally skip this warning by adding [xref: [exclude: [MyDep.MyDepMod]]] to your "def project" in mix.exs
lib/my_module.ex:50: MyApp.MyModule.process_message/1
Now, the issue is, :my_dep
IS a dependency of the current app and IS listed under the def deps
body. If I bypass this error and create the release, the local module in question CANNOT see the dep, so it’s not getting included. The question is, why not? If it’s in def deps
, why isn’t release generation seeing it?
Thanks 
1
Do you have :my_dep
limited to a environment? ie:
{:phoenix_live_reload, "~> 1.2", only: :dev}
2
Do you have a release
section in your mix.exs
that exclude - or not include - your :my_dep
?
1 Like
Nope. My mix essentially looks like this
def project do
[
app: :my_app,
name: "MyApp",
version: "0.0.1",
elixir: "~> 1.9",
build_embedded: Mix.env() == :prod,
start_permanent: Mix.env() == :prod,
deps: deps(),
releases: [
prod: [
version: "0.0.1",
applications: [
my_app: :permanent
]
]
]
]
end
defp deps do
[
{:my_dep, "~> 0.0.1"}
]
end
What does the application
function in your mix.exs
look like? IIRC this behavior can happen when things are added explicitly to applications
instead of extra_applications
.
1 Like
I don’t have deep knowledge about build steps. I would try by removing one of these lines individually and find the root cause first, then could see including your dependency into release if it is the second section.
build_embedded: Mix.env() == :prod,
releases: [
prod: [
version: "0.0.1",
applications: [
my_app: :permanent
]
]
]
def application do
[
applications: [:exts, :logger, :crypto, :sasl, :ssl, :xmerl, :peerage],
extra_applications: [:crypto],
logger: [compile_time_purge_level: :debug],
]
end
but I’m not sure that’s the issue. extra_applications
is for Erlang / Elixir specific deps, not external deps. The situation I’m experiencing is like the release builder simply isn’t seeing the deps
output. It works fine if I run it all under Iex
Yeah, I did that
. I’ve done all the sanity checks I can think of 
may I recommend a dry, swift and aged mix clean
?
remove the :applications key in application/0.
Elixir figures them out from deps
automatically. For stuff that it cannot figure out, like something part of Erlang/Elixir, put them under :extra_applications
1 Like