简体   繁体   中英

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:

  • removing a from deps folder
  • removing a from mix.lock
  • changing deps/b/mix.exs , adding a path: for the a deps entry to point to the project folder.
  • changing mix.exs for a and b to point at their respective project folders

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 ...

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM