I have scala 2.13.8 and sbt 1.5.8 installed using brew command But i am using scala 2.13.4 in intellij for my project and sbt 1.4.4.I have also installed scala plugin But my project gives unable to fetch project structure from sbt.
And thus I'm not able to install any of the dependencies.
Related
I installed scala and apache-spark using homebrew and it installed scala 2.12.4 and apache-spark 2.2.0. However, if you checkout spark-shell -version it uses a different scala version.
How do I set spark-shell to use the installed scala version? Is there way to set scala version used by apache-spark during homebrew installation?
TL;DR You cannot.
Two problems:
Spark (it is not really specific to Spark) will use Scala version which has been used to compile it. Version of Scala compile installed on the machine is not relevant at all.
Spark doesn't support Scala 2.12 yet, so recompiling is not an option.
I'm using IntelliJ CE 2017.2 on a Mac running Sierra. I've installed Java, Scala, and SBT using Homebrew and I'd like to have the same environment I have in the shell running in IntelliJ. How do I configure IntelliJ to use the existing tools?
For SBT:
File | Settings | Build, Execution, Deployment | Build Tools | SBT
On the Laucher section select custom and point to where homebrew installed sbt.
For Scala
Project Structure | Global Libraries | + | Scala SDK
On the window that poped up click Browse and point to where brew installed scala.
For Java
Project Structure | SDKs | + | JDK
On the pop up window choose the location of the jdk installed by homebrew.
Edit for SBT caveats
The sbt version is controlled by the setting sbt.version in the file project/build.properties, if that version is set to an SBT version other than the one in homebrew, intellij will download it and use it.
Make sure sbt.version as the same version number as the sbt installed by homebrew
The same may happen for scala, but in this case you can configure multiple SDKs.
I have ubuntu 14, and have installed latest sbt and then installed Eclipse for scala. I then created a scala project, and then a worksheet.
I typed in a few line like 1+2 etc, but the sheet doesn't evaluate.
Below is my system configuration:
OS: Ubuntu 14
sbt version: 0.13.13
JAVA version: 8
eclipse version: Version: 4.5.0 (neon.1)
I have NOT installed Scala.
Can someone suggest a possible solution?
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 brew, I keep getting the following error
Error: No available formula for 2.10.5
I tried downloading the binaries for scala download page but when I load the SDK and all the libraries in IntelliJ, I just get this error
Error:scalac: No 'scala-library*.jar' in Scala compiler classpath in Scala SDK scala-sdk-2.10.5
So what is the right way to install an older version of scala and setting the same in intellij
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
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
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.
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.
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
Noob question incoming.
I just uninstalled scala 2.9.2 from my machine in doing:
sudo apt-get remove scala
While the command:
scala -version
outputs:
The program 'scala' is currently not installed. You can install it by typing: sudo apt-get install scala
My scala/sbt program still functions...
Why? I do not know.
I would like to install the latest version of scala which is the 2.11.7.
My questions are:
- How do I fully uninstall scala?
- How do I install scala 2.11.7? (In which directory uncompress the .tgz? What bindings?)
SBT is not scala
the command sbt usually is a wrapper script that launches sbt-launch.jar in [home]/.sbt/launchers. Where that wrapper script is installed to heavily depends on how you installed it.
SBT downloads its own scala version into a projects target path. It is totally local, so imo there is not reason to worry about installation relics.
Thus, if you want to use scala 2.11.7, just set scalaVersion := 2.11.7 in your build.sbt