2
votes

I'm using Ubuntu 13.04 and sbt 0.12.4.

I'm new to sbt/Scala. Here's the list of Scala versions I have installed on my machine:

  • Scala 2.9.2 -- installed by sbt, and the default version that sbt choose
  • Scala 2.10.2 -- installed by myself, located in /usr/xxx/share/scala-2.10.2
  • Scala 2.10.4 -- came with Eclipse located in ~/eclipse/osgi/xx/buddle/xxx

I'd like to build a sbt project with build.sbt that says it needs version 2.10.2. After I type sbt console, it looks like:

Getting Scala 2.10.2 ...
downloading http://repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.10.2/scala-compiler-2.10.2.jar ...

...and gets stuck here. I waited four hours and couldn't get passed this. How can I fix it and change the default Scala version used by sbt?

2
are you connected to network? did you tried wget http://repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.10.2/scala-compiler-2.10.2.jar ? I had the same problem and which cannot access to mirrors.ibiblio.org. My solution was to download it from other server.ymonad
Thanks, I've download it manually, where should I put it?nzomkxia
place it to ~/.sbt/boot/scala-2.10.2/lib/scala-compiler.jarymonad
There should be few more files copied...Jacek Laskowski

2 Answers

1
votes

"change the default scala version used by sbt" - you can't (or if you managed to do so, you'll sooner or later face issues with plugins that are compiled against a particular combination of sbt and Scala versions via addSbtPlugin).

If you however need to change the version of Scala the build (and hence your artifacts) is using, then scalaVersion is your solution. It seems you've already done it saying "the build.sbt says it needs version 2.10.2".

When you start sbt you actually use a sbt launcher that gets necessary components from online repositories and boots the sbt. For this, the launcher needs to download the sbt itself and Scala jars. They're stored in ~/.sbt/boot under respective Scala version that sbt uses internally (as it's a Scala application after all).

You could download necessary modules for sbt and have it running fine, but your projects might require dependencies that are not yet in ~/.ivy2 local repository and would need getting online. You'd have to download the dependencies and the dependencies of the dependencies manually. It'd surely take some time and although possible, I'd recommend copying the directories from a machine that has access to the repositories.

0
votes

same behaviour on Mac OSX Yosemite completely slow and stuck

scala-compiler-2.10.4.jar.part

need to manually d/l it to

/Users/katopz/.ivy2/cache/org.scala-lang/scala-compiler

by curl

$ curl -o scala-compiler-2.10.4.jar http://mirrors.ibiblio.org/maven2/org/scala-lang/scala-compiler/2.10.4/scala-compiler-2.10.4.jar

and stuck now it stuck at scala-reflect-2.10.4.jar ;p