Sunday, March 15, 2009

Buildr + Scala on Ubuntu

So I got started on my Scala adventure.
Scala is a functional language and I wanted to get started with it since forever.
After playing around with it for some time I had to accept the sad truth:
The Eclipse plugin is a piece of crap.
Tons of crashes, inconsistent behavior, faulty auto-completion ....
So I had to go back to my old friend vim. The only problem was that without eclipse I needed something to do the building. I could have written some shell scripts but as we are looking for a better build system for our projects at Pramari I thought this might be the right time to do so.
Ant was no option, I already knew it and I wanted something new :)
Maven was also not an option. This tool is an abomination and if there is any tool that is able to singlehandedly make agile software development impossible then it is this monster (more rants to come, for now: If you need to dedicate a person to learn the build system you know that there is trouble coming).
After reading a ton of blog-posts I decided to give buildr a shot.
The tool looked very promising, getting scripting and building together looked very intriguing to me.
But before building the wise creators of Ubuntu and Buildr teamed up to give you a thrilling installation experience.
I have been working with Ruby on Rails for some time (Buildr is built on top of Ruby and Rake) so I expected a smooth installation using gem.
Boy, I was wrong.
It took me two days to figure out how to get it up and running.
First of all: I thought gem was a system comparable to apt-get. it's not. I tried doing gem install buildr which failed with a ton of error reports. After manually installing the required versions of rake and several other tools I ended up with a version of buildr.
To my surprise it wasn't added to a directory that in the shell path. After finding the file and calling it manually it failed with a couple of error reports.
To cut this short:
I just figured out how to get it running.
First of all: Don't try to do it from the debian gem repositories, you need to specify the version from rubyforge.
So here is what you need to do:

gem install net-ssh -version 2.0.4
gem install net-ssh -v 2.0.4
gem install net-sftp -v 2.0.1
gem install highline -v 1.4.0
gem install rubyforge -v 1.0.0
gem install hoe -v 1.7.0
gem install rjb -v 1.1.6
gem install rspec -v 1.1.5
gem install xml-simple -v 1.0.11

gem install --source http://gems.tron.name/gems.rubyforge.org/  buildr

This will give you a working version of Buildr 1.3.3.
To get builder to run with scala and java you need to specify SCALA_HOME and JAVA_HOME.
Uh, before I forget it:
Your buildfile needs to contain require 'buildr/scala' to be able to build a scala project. For some reason this line is not added if automatically creating a buildfile inside a directory hierarschy containing scala files.