How to install an older version of scala

后端 未结 5 1032
一向
一向 2021-02-02 09:59

I currently had installed scala 2.11.7 but in order to fix this issue, I have to install a older version of scala(2.10.5). When I try to install with b

相关标签:
5条回答
  • 2021-02-02 10:38

    Homebrew installs scala 2.10.5 with the formula scala210:

    $ brew install scala210
    ==> Installing scala210 from homebrew/homebrew-versions
    ==> Downloading https://homebrew.bintray.com/bottles/scala210-2.10.5.yosemite.bottle.tar.gz
    
    ==> Downloading http://www.scala-lang.org/files/archive/scala-2.10.5.tgz
    ######################################################################## 100,0%
    

    However, if you are using a build tool like maven or sbt, you should be able to set another scala version in your build config. You should then be able to import your project into IntelliJ and IntelliJ should automatically use the dependencies defined in your build config.

    0 讨论(0)
  • 2021-02-02 10:49

    Using brew to install specific version:

    $ brew search scala
    ==> Formulae
    scala                scala@2.10           scala@2.11            scalaenv             
    scalapack            scalariform          scalastyle
    
    ==> Casks
    scala-ide
    

    Make sure you default version in profile

    $echo 'export PATH="/usr/local/opt/scala@2.11/bin:$PATH"' >> ~/.bash_profile
    
    0 讨论(0)
  • 2021-02-02 10:55
    brew search scala
    

    then you will find all the available versions like below

    scala                     scala@2.10                scala@2.11                scalaenv                  scalariform               scalastyle
    homebrew/science/scalapack                                                     Caskroom/cask/scala-ide
    

    Then choose whichever version you want to install. say if you want to install scala 2.11 then you can do that by runnig the command like below

    brew install scala@2.11
    
    0 讨论(0)
  • 2021-02-02 10:56

    The following should work for Homebrew 0.9.5:

    Install Tapped version of Scala 2.10

    brew install homebrew/versions/scala210
    

    Unlink version of Scala 2.11 (if installed)

    brew unlink scala
    

    Link Tapped version of Scala 2.10

    brew link scala210 --force
    

    Check scala version

    scala -version
    
    0 讨论(0)
  • 2021-02-02 10:59

    If you manage your project with sbt, the scala built tool, either directly or via IntelliJ, the version of scala for that code is defined in the build file (build.sbt or Build.scala):

    scalaVersion  := "2.10.5"
    

    Choosing this path, there isn't even a need to install scala on your Mac at all. Each project will have its own version -- pulled from your local ivy repository, so it doesn't have to download it each time.

    And rather than typing scala to get to the REPL, you type sbt console to get to the REPL with the project's scala version and dependencies loaded.

    0 讨论(0)
提交回复
热议问题