Dependency name clash - decimal

How can this be solved? There are two decimal deps out there with identical names.

We have an erlang package that uses decimal (the old, erlang decimal package, that is called erlang_decimal in hex nowadays), but we also need another dependency that uses the elixir decimal package. In the deps section of the mix.exs file there are two deps with the same name here:

{:decimal, "~> 2.0"},  # the Elixir Decimal module
{:decimal, "~> 0.6.2", hex: :erlang_decimal} # the Erlang :decimal module

This is definitely not OK. If I rename the 2nd one to :erlang_decimal, then the problem is that Mix looks for the .app file of the erlang_decimal package as erlang_decimal.app, which is actually decimal.app, since the app name is still decimal. At this point I froked the erlang_decimal into a local git repo and renamed the application to erlang_decimal properly, and then forced the top level app to load this forked version instead of the erlang_decimal hex package. This works with the .app files, but then another problem bumped up: a reference to an .hrl file in an erlang dependency that uses the old erlang decimal app:

-include_lib("decimal/include/decimal.hrl").

I could just fork this erlang app too, and change the path to "erlang_decimal/include/decimal.hrl", but at this point I believe this isn’t the right thing to do.

Do you have any suggestions how to get rid of this decimal problam?

1 Like

You can not have 2 applications with the same name.

You have to decide on one of them.

Or as you already started, forking and patching down the rabbit hole.

1 Like

Thanks for the answer. I know that rule in general. The thing is that in this particular case, it would be possible to have both apps loaded, since one of then uses the Decimal, the other one uses the :decimal namespace for modules. Only the app names are colliding.

1 Like

Yes, and that’s why you need to change one of them and use the patched name throughout the dependees by patching them.

1 Like