Archive for September, 2006|Monthly archive page

Raven: Building Java with Ruby

I haven’t been writing for quite a while now and that’s because I’ve been busy. I’ve been working on some sort of pet project: Raven. The idea is to use a really powerful language that can elegantly address scripting in build scripts: Ruby.

The good thing is I didn’t have to start from the ground up, Ruby already has two very neat and robust tools that helped me quite a lot: Rake and RubyGems. Here is how I leveraged them:

  • I’ve used RubyGems to solve the dependency problem. Java jars are wrapped in a Gem. That’s all. From there RubyGem does all the job of looking up needed dependencies, managing local and remote repositories, installing the dependencies, handling the different versions.
  • I’ve used Rake to solve the build script and task problem. It makes it easy for you to create a build script with different tasks an tasks prerequisites. And from there, hey, it’s plain Ruby!

Now you could be wondering what Raven is doing after all, if all these features are already provided. Here we go:

  • First it does all the wrapping work, importing either your local Maven (1 or 2) repository into the local Gem repository or building a remote Gem repository. So if you’re already using Maven you can get started really, really quickly. If you don’t, you’ll just have to setup your own repository, Raven makes it easy.
  • Second it manages your dependencies. Or more precisely it talks to Gem to check where your dependencies can be found and install them locally. These installed Gems will then be used to build your classpath.
  • Third and finally, it provides a set of already defined Rake tasks for the most common operations. Things like compiling, building a jar from your classes, javadoc, etc …

To illustrate, this is a simple “Hello World” style example of a rakefile that could be used to build a project:

require 'raven'
require 'rake/clean'



dependency 'compile_deps' do |t|
    t.deps << [{'commons-logging' => '1.0.4'}, 'commons-pool']
    t.deps << ['commons-lang', 'wsdl4j', 'log4j']

javac 'compile' => 'compile_deps' do |t|
    t.build_path << "src/main/java"

jar 'ode-utils.jar' => 'compile'

The best part of it is it’s quite plain Ruby. So you can simply script your build the way you want to! No more XML fighting or plugin fiddling! So if you feel that this cool could fit your needs, just check it out!

P.S. This idea came during a lunch break with Assaf, we were discussing the pains of the different solutions in Java to get a build done, when Ruby had such excellent tools. So thanks man for your great ideas!


Where Does Your Money Go?

I usually don’t mind paying tax, I consider it as being part of an organized society. It always hurts a bit of course (greedy, greedy) but I happen to earn enough money to have a comfortable life and don’t mind giving part of it to help those who really need it. So that’s more or less my ideal tax spending budget: a part for services to the society at large (police, schools, justice, research, …) and a part to help the ones in difficulty (social security, medicare, unemployment, …).

So I was wondering how my tax money was used here, especially federal tax (the biggest part of it). Here it is:

Tax usage for FY2006

Source: National Priorities Project

Yeah, the military and interest parts kind of hurt. I’ll let you meditate on these figures and how much you personally give for each of these little pie slices.