Just spent a day on finding out how to handle dependency problems when I need two different versions of one package. I am aware that there is always the option to create my own package.
Nevertheless, what I ended up doing was:
- forking the dependency which I need two versions of
- branching it
- rename the module using: GitHub - MainShayne233/rename: Rename your Elixir apps
- commit to the new branch
- in mix.exs add dependency from my fork with the specific branch and the original / different version separately
I guess for most people this is not really a challenge… first timers are always harder. Nevertheless I wanted to ask if there is a better way. (From the other entries here I don’t think so).
I don’t really like that I end up having a forked version without an other reason besides the renaming.
Is this such a rare case that one has/wants to do so?
Could one write maybe a
@before_compile Macro or something similar in order to automatically rename some dependencies or keeping them “private” respectively?
Maybe based on an “alias” or “namespace” tag in the mix.exs file.
My guess is that this would lead to more complexity and therefore the “forking” approach is considered better. And I have no clue how this would work, just out of curiosity.