简体   繁体   中英

Correct version in mix.exs dependency declaration

I have a mix.exs file that has some dependencies:

def deps do
    [{:nadia, "~> 0.4"}]
end

Let's say I want to change Nadia to version 0.3 . I'm having a hard time doing that.

After making the change to mix.exs , I can't get the version 0.3 for Nadia. Neither mix deps.update nor mix deps.unlock && mix deps.update help me.

I'm sure there's a way to do this; I just couldn't find it.

Thanks in advance!

The reason the requirement ~> 0.3 gives you 0.4.0 is because ~> 0.3 is equivalent to >= 0.3.0 and < 1.0.0 ( ref ). If you want >= 0.3.0 and < 0.4.0 , you need to use the requirement ~> 0.3.0 :

def deps do
  [{:nadia, "~> 0.3.0"}]
end

A simple mix deps.get after changing your mix.exs will give you the latest 0.3.x version of nadia . There's no need to run mix deps.unlock or mix deps.update .

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