You have to change the boot properties. There is a nice description in the recent blog decodified from Mathias:
"How to make SBT download scala library sources" (started from @hseeberger key starting points)
Here is the relevant part (in case that link ever goes stale)
First, forget about trying to find some “hidden” setting in your SBT project definition enabling Scala library source download! It does not exist (at least not in SBT version 0.7.x).
Rather, there are these two things you need to do in order to whip SBT into submission:
- Create an alternative configuration file for your SBT launcher.
- Make the SBT launcher use it.
These are the steps in detail:
- Find your
sbt-launcher-0.7.x.jar
file.
Since I’m on OS/X and use SBT via Homebrew mine lives at /usr/local/Cellar/sbt/0.7.5.RC0/libexec/sbt-launch-0.7.5.RC0.jar
.
- Extract the
sbt.boot.properties
from the sbt
sub directory in the launcher jar
- Fire up your favorite editor and change line 3 to classifiers:
sources
(uncomment the line)
- Find the sbt script file you created during your SBT setup (e.g.
~/bin/sbt
, or, when using Homebrew, /usr/local/Cellar/sbt/0.7.x/bin/sbt
)
- Add the path to your tweaked
sbt.boot.properties
file, prepended with an ’@
’ character and in double quotes, as the second-to-last argument of the java call.
This is what my sbt script file looks like:
#!/bin/sh
java -Xmx768M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256m \
-jar /usr/local/Cellar/sbt/0.7.5.RC0/libexec/sbt-launch-0.7.5.RC0.jar \
"@/usr/local/Cellar/sbt/0.7.5.RC0/libexec/sbt.boot.properties" \
"$@"
Once you have completed these steps SBT should happily download the scala-...-sources.jar
files for the Scala compiler and standard library for any new project you create.
To have SBT do this for an existing project, you have to manually delete the project/boot/scala-{version}
directory before performing an ‘sbt update
’ (SBT does not fetch additional source artifacts if the main jar is already present).
Once you have a custom sbt.boot.properties
file, there are also other ways to supply it to the SBT launcher.
See SO question "how do I get sbt to use a local maven proxy repository (Nexus)?"