While I’m waiting for the Kindle version of Atomic Scala to be released, I’m going to work my way slowly through the Scala Koans. I got up and running really qiuckly, but the instructions at http://www.scalakoans.org/installation are a little out of date. Here’s what worked for me (on Windows 7, with IntelliJ Idea 12.1.3):
- Download the Koans
- Unzip them somewhere
- Edit koans.bat so it looks like this: This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
set SCRIPT_DIR=%~dp0 java -Dfile.encoding=UTF8 -Dsbt.boot.directory=.\sbtboot -Dsbt.ivy.home=.\ivyrepo -Xmx512M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256m -jar "sbt-launch.jar" - Run koans.bat (if you’re behind a firewall, you’ll need to set your proxy) This will download SBT, the Scala Simple Build Tool and start it. You’ll be left at the SBT prompt: “>”
- Compile the tests: “> test:compile”
- Start the tests running constantly: “> ~test-only org.functionalkoans.forscala.Koans” You will see your first task: “Please meditate on Koan …” This is your cue to start fixing the koans, and learning Scala and ScalaTest
- Start up IntelliJ IDEA
- Import a project – create it from existing sources. To do this just point IDEA at the unzipped archive. It should guess everything. Make sure you use JDK 1.6 as 1.7 isn;t currently totally supported
- Find the scala test you’re being prompted to fix (it’ll most likely be dmarsh-scalakoansexercises-8d7da93dd5f2\src\test\scala\org\functionalkoans\forscala\AboutAsserts.scala)
- Fix the first broken test and switch back to your CMD window where SBT is running
- You’ll see it announce “Compiling 1 Scala source to …” and if you’ve fixed the test you’ll get a new prompt to meditate on the next one.
- Rinse. Repeat.
Thanks for your post. This whole time I thought I was doing something wrong. I'm glad there was a solution.
ReplyDeleteNP. Glad it helped. I really like the Koans. They need a few tweaks though (IMHO). I need to get round to submitting them...
Delete