简体   繁体   中英

How can I install older version (0.13.x) sbt on my MAC?

I need sbt version 0.13.x for a course in Scala and I am having difficulties installing it. I tried with the "brew install sbt@0.13" command, but when I then check with "sbt about" it gives a message "No such file or directory".

However, if I again try and do "brew install sbt@0.13", it gives "Warning: sbt@0.13 0.13.16 is already installed", although "sbt about" does not find anything.

In addition to that, I tried installing the latest version of sbt with “brew install sbt” and then manually changing the version each of my projects is using by entering “sbt.version=0.13.12“ in a given “build.properties” file. This seemed to work initially, when I check with the terminal the version of sbt inside the project. However, I am still not able to import already existing projects.

Finally, I downloaded the version from http://www.scala-sbt.org/download.html but then I need to do some corrections to my "PATH" from what I've read online and I am not sure what that means. So, I would be grateful if someone could help me with the installation of an older version.

The way sbt works is that it will look in project/build.properties for the sbt version to use to build your project. So the way you described - installing the latest sbt and set the version you want to use for the build in project/build.properties - should work just fine. Regarding

not able to import already existing projects

these existing projects also should have project/build.properties indicating the sbt version.

Note that even with installing 0.13.12 locally, when building your project sbt will still use the version specified in project/build.properties , it will just download it as necessary.

If you absolutely want to run a specific version from the command line, as you already discovered, you can download it. Regarding updating your PATH - PATH is an environment variable that tells your command line where to look for executable files. It's a list of directories, so if you unpacked the downloaded file in say " $HOME/tools ", you have so say something like export PATH=$HOME/tools/sbt/bin:$PATH . See https://www.cyberciti.biz/faq/appleosx-bash-unix-change-set-path-environment-variable/ for a more detailed description.

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