Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You'll level up much faster with an IDE (IMO).

Ensime in Sublime is kinda pointless I think since it only updates on file change. The REPL and SBT integration is nice.

I use Sublime for quick examples in Scala, or as a VIM alternative for larger projects (as opposed to my main editor like with Ruby).

For most of my Scala work I use IntelliJ though. The lack of half-decent theming in Eclipse and Preferences/Settings being all over the place really puts me off ScalaIDE personally.

Going from Zero to Code in IntelliJ and SBT (on OSX) is pretty trivial. Given a command-line "Hello World" with a traditional Maven layout:

First, install IntelliJ, navigate to "Plugins" under preferences and install the Scala plugin.

Now make sure you have Homebrew installed (http://brew.sh)

  $ brew update
  $ brew install sbt --devel # currently 0.13.0-RC5
  $ cd ~/src/
  $ mkdir hello-world
  $ cd hello-world
  $ mkdir project
  $ echo "sbt.version=0.13.0-RC5" | tee project/build.properties
  $ cat <<EOS | tee project/plugins.sbt
    resolvers += "Sonatype snapshots" at "http://oss.sonatype.org/content/repositories/snapshots/"

    addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.5.0-SNAPSHOT")
    EOS
  $ cat <<EOS | tee build.sbt
    name := "hello-world"

    version := "1.0-SNAPSHOT"
    EOS
  $ mkdir -p src/main/scala
  $ cat <<EOS | tee src/main/scala/Whatever.scala
    object Whatever extends App {
      println("Hello World!")
    }
    EOS
  $ sbt
  > compile
  > gen-idea
  > run
And there you go. It could be simpler if we were having a LOC competition, but this is actually very close to the exact setup I use for projects day in and day out, including getting a jump on the next version of SBT and best-practicey stuff like setting the SBT version in build.properties.

If this were a Play app, you might have a "project/plugins.sbt" that looked something like this (to get a jump on the upcoming Scala 2.10 version of Play, that integrates with SBT 0.13.x):

  // Comment to get more information during initialization
  logLevel := Level.Warn

  resolvers := Seq("Maven Central" at "http://repo1.maven.org/maven2/",
                "Typesafe Snapshots" at "http://repo.typesafe.com/typesafe/snapshots/",
                "Typesafe Releases" at "http://repo.typesafe.com/typesafe/releases/",
                "Sonatype snapshots" at "http://oss.sonatype.org/content/repositories/snapshots/")

  addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.0-M2")

  addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.5.0-SNAPSHOT")
This just adds a few more common resolvers you might use for dependencies, and locks you to the latest Play milestone snapshot. You can pretty much otherwise copy/paste files/folders from a sample Play app, like you might see with the Typesafe Activator for example.

Good luck!



Excellent, thx.

(just remember "brew doctor" first).

Also for non-maccies: http://www.scala-sbt.org/0.13.0/docs/Getting-Started/Setup.h... (it would be nice to discuss the red hat and debian distro families in that Setup page, it looks like you can't currently "apt-get sbt"


Wow, thanks so much for this! I really appreciate it.


there's this https://github.com/n8han/giter8 project that's supposed to create scala project templates for you from the command line, but never really got into it so i can't really comment.


  > The lack of half-decent theming in Eclipse and
  > Preferences/Settings being all over the place
  > really puts me off ScalaIDE personally.
Agree. I can recommend http://eclipsecolorthemes.org/ combined with https://github.com/jeeeyul/eclipse-themes.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: