Dependency Warning: Poison.decode!/2 defined in application :poison is used by the current application but the ... does not depend on :poison

Hi all! I’m getting a warning-

Poison.decode!/2 defined in application :poison is used by the current application but the current application does not depend on :poison. To fix this, you must do one of:

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

  2. If :poison 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 :poison, you may optionally skip this warning by adding [xref: [exclude: [Poison]]] to your "def project" in mix.exs

I’ve seen some similar issues and solutions proposed elsewhere on this forum, but they don’t seem to solve it for me. I have an internal mock server for API function testing… maybe I’ve got something screwed up in my mix file!

My relevant mix.exs snippet

 def application do
    [
      extra_applications: [:logger],
      mod: {TruckSched.Application, [env: Mix.env()]},
      applications: applications(Mix.env())
    ]
  end

  defp applications(:test), do: applications(:default) ++ [:cowboy, :plug]
  defp applications(_), do: [:httpoison]

  # Run "mix help deps" to learn about dependencies.
  defp deps do
    [
      {:httpoison, "~> 2.0"},
      {:poison, "~> 5.0"},
      {:plug_cowboy, "~> 2.6"},
      {:mix_test_watch, "~> 1.0", only: :dev, runtime: false}
    ]
  end
end

Versions if helpful-

elixir 1.13.4-otp-25
erlang 25.0.3

Thanks for any help!

I believe this should just be

defp applications(_), do: [:poison]
2 Likes

Good grief, thank you for the sanity check :sweat_smile:

1 Like

Hmm still actually getting the error after the change.

Tried rm -rf _build deps && mix do deps.get after the change as well.