BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Raven: Building Java with Ruby

Raven: Building Java with Ruby

Bookmarks

A new alternative in the building tools space is Raven. Raven allows you to use Ruby tools such as Rake and Gem to build Java projects. Build scripts are Ruby scripts, rather than being XML files, and it imports your local Maven repository and handles dependencies.

Matthiew Riou created Raven because he felt that XML was "painfully awkward when it comes to building things." His secondary motivation was that Ant and Maven do not provide a good way to script the build process. Raven allows you to write your build script in Ruby code, giving you all the flexibility you could need.  Raven wraps jars as Ruby Gems, so that they can be managed by gem.  Gem is a dependency tool that allows you to list, install, and uninstall packages in a single command.  Then you declare the dependencies in a Rake file.

An example of how to install dependencies using Raven is:

    # Installs the latest version of commons-httpclient
 raven install httpclient
 # Installs explicitly xstream 1.2 from the xstream module
 raven install -g xstream xstream:1.2
 # Installs all Axis2 modules (from the axis2 group)
 raven install --all -g axis2

The Rakefile would then use the dependencies:

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

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

Full examples of a Raven file and to import a Maven repository are available.

Assaf notes that this could be the return of simplicity to the Java world, while Kofno takes a quick look and finds a few concerns including weak Eclipse support and light documentation, specifically in installing a jar that is not in a Maven repository already.  TheServerSide has a discussion thread going where the main concern is introducing yet another language to the development process.  One alternative would be Gant, which is built on Groovy and thus allows you to stick with the JVM.  This concern may disappear as JRuby closes in on 1.0.

Rate this Article

Adoption
Style

BT