jisaacstone
jisaacstone

Reputation: 4264

How to manage package interdependencies in mix?

I've got a couple useful libraries I've build for elixir. I've put them both up on hex. I already use library A in library B, and I've just incorporated library B as a dependency for library A. Now of course library A won't build.

Error while loading project :a at /Users/me/fun/a/deps/ar ** (Mix) Trying to load ArgumentParser.Mixfile from "/Users/me/fun/a/deps/a/mix.exs" but another project with the same name was already defined at "/Users/jistone/fun/a/mix.exs"

Here is what I have tried so far:

All fail with appropriate error messages.

So question is: how to get mix to recognize a dependency is satisfied by the current project being built?


edit: more details

Package a is a library for parsing command line arguments. Package b is a mix task for generating README.md files. In package b I used package a to parse the command line arguments for the mix task. Now I am trying to use the mix task to generate the README.md for package a, and I get the above failure.

I can workaround by starting an iex session and loading the relevant beam files, but I'd like to get the mix task working if possible ...

Upvotes: 1

Views: 1031

Answers (1)

jisaacstone
jisaacstone

Reputation: 4264

3 solutions I've found (none of them perfect)

  • Building the readme docgen project as an escript and then removing it as a dependency.

  • Changing the name of the project in the mix.exs file, generating the docs, then changing it back.

  • Loading all the beam files using the -pa arg in iex and running the code manually.

Upvotes: 0

Related Questions