BT

Raven: Building Java with Ruby

by Rob Thornton on Nov 07, 2006 |

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.

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2014 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT