ericmj / decimal

Arbitrary precision decimal arithmetic

Home Page:https://hexdocs.pm/decimal/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The lock is missing for package decimal in umbrella app

mojidabckuu opened this issue · comments

May be there is a reason why 2.0.0rc is still rc, but

mix phx.new thedecimal --umbrella --no-html --no-webpack
cd thedecimal_umbrella
cd apps/thedecimal
vi mix.exs
# add {:decimal, git: "https://github.com/ericmj/decimal", tag: "v2.0.0-rc.0", override: true},
cd ../..
mix deps.get

after download and listing it gives

* Updating decimal (Hex package)
** (Mix) The lock is missing for package decimal. This could be because another package has configured the application name for the dependency incorrectly. Verify with the maintainer of the parent application

if omit override: true then it conflicts with older version of decimal from Ecto

Dependencies have diverged:
* decimal (Hex package)
  different specs were given for the decimal app:

  > In deps/ecto/mix.exs:
    {:decimal, "~> 1.6 or ~> 2.0", [env: :prod, hex: "decimal", repo: "hexpm", optional: false]}

  > In apps/thedecimal/mix.exs:
    {:decimal, [env: :prod, git: "https://github.com/ericmj/decimal", tag: "v2.0.0-rc.0"]}

  Ensure they match or specify one of the above in your deps and set "override: true"
** (Mix) Can't continue due to errors on dependencies

This doesn't happen with non umbrella app🤷 What are the alternatives?

I am definitely interested in such fixes like #150 compared to 1.8.1 and may be others as well :)

Thanks

You need to add the override to the top level umbrella project's mix.exs file since both umbrella children, thedecimal and thedecimal_web, have a transitive dependency on decimal you cannot override it in either since siblings cannot override each other.

The error message is a bug in elixir, I will look into it.

Btw, I was able to reproduce this locally (thanks for the steps!) and defining the dependency like the following fixed it:

      {:decimal, "2.0.0-rc.0", override: true}

@ericmj edit to root level mix.exs did the job. Thanks!