672329 members! Sign up to stay informed.

Sponsored Links


Resources

Enterprise Java
Research Library

Get Java white papers, product information, case studies and webcasts

News News News Messages: 19 Messages: 19 Messages: 19 Printer friendly Printer friendly Printer friendly Post reply Post reply Post reply XML XML XML

Raven 1.2: Build Java with JRuby

Posted by: Matthieu Riou on December 19, 2006 DIGG
Raven is a build system that leverages Ruby tools (namely Rake and Gems) to let you build Java projects easily. It provides a way to handle dependencies, specific Rake tasks for Java, all based on Ruby. This release adds support for JRuby 0.9.1 and JUnit test cases.

Why base your build system on Rake and Ruby Gems? For one thing, Rake is a very simple build system; it uses domain specific tasks; it's based in Ruby, a script language, rather than using Java in a way Java wasn't necessarily meant for. Ruby Gems is a packaging system, a bit like yum, CPAN or apt-get. It conveniently handles package installation, update and removal.

Here is what Raven will allow you to do:

* Your jar files are wrapped in a Ruby Gem (a package). You can then start manage your java jar library just like a Gem library. Tools are provided to convert a Maven jar repository to a Gem repository (both local on your machine or on a public server) or to directly install packages.
* Your dependencies are declared in a Rakefile. You basically say which Gems you need (and so which jars will be included in your classpath) for building. When building, if some Gems are missing, they are automatically installed in your local Gem repository, just like Maven.
* Raven gives you a small library of Rake tasks that you can use to compile your java classes, build a jar file, build a war file, produce javadoc, wrap the jar you built in a Gem, etc.
* This effectively gives you everything you need to build Java projects, using Gems for dependencies management and Rake for scripts.

This latest release is available both as a gem or prepackaged in JRuby. Unzip, set the JRuby home and run. And starting JUnit tests is as simple as:

junit 'run_tests' => 'compile'

Check it out at http://raven.rubyforge.org/. More on http://mriou.wordpress.com

Threaded replies

·  Raven 1.2: Build Java with JRuby by Matthieu Riou on Tue Dec 19 11:53:08 EST 2006
  ·  please help me understand the benefit by Eric Johnson on Tue Dec 19 15:11:03 EST 2006
    ·  Re: please help me understand the benefit by Matthieu Riou on Tue Dec 19 15:19:04 EST 2006
      ·  Re: please help me understand the benefit by Ilya Sterin on Tue Dec 19 17:56:39 EST 2006
        ·  Re: please help me understand the benefit by Ilya Sterin on Tue Dec 19 17:58:13 EST 2006
      ·  Re: please help me understand the benefit by Artur Karazniewicz on Wed Dec 20 16:21:42 EST 2006
    ·  Re: please help me understand the benefit by Mileta Cekovic on Tue Dec 19 17:58:18 EST 2006
      ·  Re: please help me understand the benefit by Ilya Sterin on Tue Dec 19 22:10:39 EST 2006
    ·  Learning Xml Vs learning a new language by paul browne on Wed Dec 20 06:29:33 EST 2006
      ·  Re: Learning Xml Vs learning a new language by Mileta Cekovic on Wed Dec 20 07:09:47 EST 2006
  ·  Re: Raven 1.2: Build Java with JRuby by Regis LOWE on Tue Dec 19 16:15:31 EST 2006
  ·  Beanshell *rulez* by Peter Thomas on Wed Dec 20 03:20:14 EST 2006
    ·  Re: Beanshell *rulez* by Mileta Cekovic on Wed Dec 20 05:54:41 EST 2006
    ·  Re: Beanshell *rulez* by Ilya Sterin on Wed Dec 20 08:47:11 EST 2006
      ·  Re: Beanshell *rulez* by Peter Thomas on Wed Dec 20 11:44:30 EST 2006
      ·  Re: Beanshell *rulez* by Dmitriy Kopylenko on Wed Dec 20 16:21:46 EST 2006
        ·  Re: Beanshell *rulez* by Ilya Sterin on Wed Dec 20 17:09:52 EST 2006
          ·  Re: Beanshell *rulez* by Phil Swenson on Fri Dec 22 05:06:42 EST 2006
            ·  Re: Beanshell *rulez* by Phil Swenson on Fri Dec 22 05:08:09 EST 2006
  ·  XML as script is bad.. by Per Arneng on Fri Dec 14 04:41:44 EST 2007
  Message #224304 Post reply Post reply Post reply Go to top Go to top Go to top

please help me understand the benefit

Posted by: Eric Johnson on December 19, 2006 in response to Message #224218
What is it Raven gives me over ANT or Maven?

If the answer is that it's written in Ruby... why would any of us care?

-- maybe this is just an attempt to drum up some activity on tss in the slow tech news week before christmas. --

  Message #224308 Post reply Post reply Post reply Go to top Go to top Go to top

Re: please help me understand the benefit

Posted by: Matthieu Riou on December 19, 2006 in response to Message #224304
It takes a lot of time and a lot of XML to get a build working with Ant. As for Maven it takes a lot of time to keep it working over time (at least with Maven2).

The point of Raven isn't to be written in Ruby, it's to be built on top of Rake, a very nice build system. It's purely script which is much better than XML and allows you to write and maintain you build with far less pain (and time).

You might be interested by the following article for more info about Rake:

http://www.martinfowler.com/articles/rake.html

(I have nothing to do with Martin Fowler, it's just a nicely written article.)

  Message #224314 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Raven 1.2: Build Java with JRuby

Posted by: Regis LOWE on December 19, 2006 in response to Message #224218
Raven could have been the silver bullet for building projects if the learning of a new language was not required.
Anyway, congrats on your work.

  Message #224321 Post reply Post reply Post reply Go to top Go to top Go to top

Re: please help me understand the benefit

Posted by: Ilya Sterin on December 19, 2006 in response to Message #224308
It takes a lot of time and a lot of XML to get a build working with Ant.


Depends on what type of a build your designing. If it's relatively standard and straight forward and doesn't require a lot of conditionals, logic, etc..., I'd say it's pretty fast.

As for Maven it takes a lot of time to keep it working over time (at least with Maven2).


Please explain? I've used Maven 2 on most projects in the last year + and have yet to run into any issues. It's less flexible than ant say, for highly customized builds, but I'd argue that we should waste our time on highly customizing builds for 90% of projects we work on and can greatly benefit form a standardized build structure. We can argue that war and ear archive are bad because they follow a strict packaging convention in that case. I think maven 2 rocks personally.


The point of Raven isn't to be written in Ruby, it's to be built on top of Rake, a very nice build system. It's purely script which is much better than XML


How is it better than XML? It's not a buld specific DSL per say. The only thing it does better than XML is allows you to actually program logic and conditionals into your build process. I'd argue that we should instead extend ant to allow embedding of scripts like jruby/jython, etc... instead of creating a completely scriptable system. XML is there to describe the build, scripting language should be there to fill in the gaps of things you can't easily describe. I don't see any benefit of a 100% scriptable build system over XML. In that case, I can just use a perl script and customize everything I want.

Ilya

  Message #224322 Post reply Post reply Post reply Go to top Go to top Go to top

Re: please help me understand the benefit

Posted by: Ilya Sterin on December 19, 2006 in response to Message #224321
Typo...

but I'd argue that we should waste our time on highly customizing builds for 90% of projects we work on and can greatly benefit form a standardized build structure.


I meant we shouldn't waste our time...

  Message #224323 Post reply Post reply Post reply Go to top Go to top Go to top

Re: please help me understand the benefit

Posted by: Mileta Cekovic on December 19, 2006 in response to Message #224304
What is it Raven gives me over ANT or Maven?

If the answer is that it's written in Ruby... why would any of us care?


Experience has shown that you need a scripting language with all control flow constructs for building complex systems (dozen of times I needed them). Declarative and functional aspects of Ant are simply not enough. Although there are third-party tasks for condition (if-then-elsif-else, choose-when...) and iteration, it's a pain using them with all that XML syntax.

  Message #224333 Post reply Post reply Post reply Go to top Go to top Go to top

Re: please help me understand the benefit

Posted by: Ilya Sterin on December 19, 2006 in response to Message #224323
What is it Raven gives me over ANT or Maven?

If the answer is that it's written in Ruby... why would any of us care?


Experience has shown that you need a scripting language with all control flow constructs for building complex systems (dozen of times I needed them). Declarative and functional aspects of Ant are simply not enough. Although there are third-party tasks for condition (if-then-elsif-else, choose-when...) and iteration, it's a pain using them with all that XML syntax.


Agree, and it's also a pain describing things that should be by nature declarative using a scripting language. Though we need a mix of both. We should be able to hook into the ANT APIs and have support for scripting right within the ant build file, or by referencing some external script, though ant should be able to pass it's control flow onto those scripts for that particular scope.

Ilya

  Message #224341 Post reply Post reply Post reply Go to top Go to top Go to top

Beanshell *rulez*

Posted by: Peter Thomas on December 20, 2006 in response to Message #224218
IMHO there is no need for any Ant replacement. You can easily extend Ant with a scripting language like Beanshell without the need to compile anything or mess with your Ant classpath.

I blogged about it here:

http://ptrthomas.wordpress.com/2006/12/18/how-to-shutdown-hsqldb-from-ant/

  Message #224352 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Beanshell *rulez*

Posted by: Mileta Cekovic on December 20, 2006 in response to Message #224341
Also, Ant properties and expressions need to be more powerful.
These are much better in NAnt (functions, custom functions, etc), but still not perfect. Maybe standard EL could be used?

  Message #224353 Post reply Post reply Post reply Go to top Go to top Go to top

Learning Xml Vs learning a new language

Posted by: paul browne on December 20, 2006 in response to Message #224304
I've seen similar approaches (using Perl instead of Ruby) and IMHO , it just ends up a mess. People supporting the system have to know Java *and* the 2nd language. If your build is so complicated that you need to power of a full blown scripting language, then perhaps you need to look again at your project structure.

The Java community should focus on improving ANT / Maven (which does have many drawbacks), rather than use a solution , while good for it's niche (e.g. if you're already using Ruby / JRuby in your application) is going to hinder rather than help in most situations.

Paul , Technology in Plain English

  Message #224356 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Learning Xml Vs learning a new language

Posted by: Mileta Cekovic on December 20, 2006 in response to Message #224353
I've seen similar approaches (using Perl instead of Ruby) and IMHO , it just ends up a mess.

Yes, but simulating control flow constructs with targets/dependencies/if/unless with modest expressions available in Ant could lead too to real mess.

If your build is so complicated that you need to power of a full blown scripting language, then perhaps you need to look again at your project structure.


I believe this is wrong. There are number of common cases when you need control flow constructs in build scripts (condition, iteration, exception handling), even in moderate complex projects:
- deploying to different environments needs condition. Something is deployed to UAT, something not, etc...
- when deploying for the first time to the environment you do different things then when upgrading environment (for example you may need to stop your system before upgrading environment)
- you may need try-catch-finally construct to to clean-up when build fails (for example to undo incrementation of build number)

People with more experience in writing build scripts can sure give you more examples. It's the fact of life: you need more powerful control flow/exception handling/variables and expressions in build scripts then you have it with Ant.
I saw couple of times extraordinary complex Ant builds that could be much simpler if Ant were more powerful.

Maybe retrofitting Ant with scripting language is not a good idea, but Ant sure is passing it's zenith, we need another (more expressive) build tool, but with all the goodies of existing Ant tasks.

  Message #224367 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Beanshell *rulez*

Posted by: Ilya Sterin on December 20, 2006 in response to Message #224341
IMHO there is no need for any Ant replacement. You can easily extend Ant with a scripting language like Beanshell without the need to compile anything or mess with your Ant classpath.

I blogged about it here:

http://ptrthomas.wordpress.com/2006/12/18/how-to-shutdown-hsqldb-from-ant/


This is no different than using an exec task and executing some shell script, or any other interpreter with a script file.

I think what's needed is a tighter integration, where besides being able to execute arbitrary scripts/commands, you can actually execute an interpreted snippet within ant's runtime with the access to it's properties/APIs.

Ilya

  Message #224393 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Beanshell *rulez*

Posted by: Peter Thomas on December 20, 2006 in response to Message #224367
This is no different than using an exec task and executing some shell script, or any other interpreter with a script file.


Well, just for argument's sake, I updated the post showing how you can have the script inline - within the Ant file itself.

http://ptrthomas.wordpress.com/2006/12/18/how-to-shutdown-hsqldb-from-ant/

It is a bit of a hack but it works. Apologies for linking back to my blog, but I was not sure about XML escaping over here.

My main point is that there is no need to learn a new language.

I think what's needed is a tighter integration, where besides being able to execute arbitrary scripts/commands, you can actually execute an interpreted snippet within ant's runtime with the access to it's properties/APIs.


I do agree, we should improve Ant rather than try to go after other languages.

  Message #224408 Post reply Post reply Post reply Go to top Go to top Go to top

Re: please help me understand the benefit

Posted by: Artur Karazniewicz on December 20, 2006 in response to Message #224308
It takes a lot of time and a lot of XML to get a build working with Ant.


Huh? For an average Java programmer building working buildfile (compile, clean, package etc) takes, from my experience no more than 5 minutes. Add to this EXCELLENT
IDE support with syntax highlighting, code completion, documentation, parameter hints, code snippets and even debugging makes Ant pretty convenient tool. So please don't spread informations like above. Especialy talking about half-baked, unknown, unsuported writen in different language tool like Raven. Does it have support for convenient creation of EARs at least?

Artur

  Message #224409 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Beanshell *rulez*

Posted by: Dmitriy Kopylenko on December 20, 2006 in response to Message #224367
IMHO there is no need for any Ant replacement. You can easily extend Ant with a scripting language like Beanshell without the need to compile anything or mess with your Ant classpath.

I blogged about it here:

http://ptrthomas.wordpress.com/2006/12/18/how-to-shutdown-hsqldb-from-ant/


This is no different than using an exec task and executing some shell script, or any other interpreter with a script file.

I think what's needed is a tighter integration, where besides being able to execute arbitrary scripts/commands, you can actually execute an interpreted snippet within ant's runtime with the access to it's properties/APIs.

Ilya


There is such an effort under way. It's called Gant (Groovy Ant). I've tried it with couple of prototype build scripts and I like it!

http://groovy.codehaus.org/Gant

Regards,
Dmitriy.

  Message #224416 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Beanshell *rulez*

Posted by: Ilya Sterin on December 20, 2006 in response to Message #224409


There is such an effort under way. It's called Gant (Groovy Ant). I've tried it with couple of prototype build scripts and I like it!

http://groovy.codehaus.org/Gant

Regards,
Dmitriy.


That actually sounds interesting. By looking at it, it still seems as it's taking you away from XML. I don't think XML is bad. It's very readable in many instances, plus you get out of the box completion, validation, etc... support with most IDEs. The issue comes when XML is used as a DSL. I think a mix of Ant XML and some scripting (or any) language is needed. Basically it's about extending ant and allowing for some custom script task that has access to some Ant runtime interface. Or actually, a better approach would be to allow some sort of an AOP facility for tasks. So each task that's already there, can be extended with some scripting functionality using AOP.

So say,

<task>
... task specific configs...
<beforeTask location="some_script"/>
<afterTask location="some_script"/>
</task>

And each task, might be able to provide other pointcuts that are custom for a task. So a task execute can be a template method pattern, that allows to inject some custom code anywhere within it.

This is just off the top of my head, I'm sure it can be designed in a more robust way. But such a system would allow to easier extend current tasks, without having to write custom tasks each time something is needed that is not supported by available libraries.

Ilya Sterin

  Message #224501 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Beanshell *rulez*

Posted by: Phil Swenson on December 22, 2006 in response to Message #224416
"By looking at it, it still seems as it's taking you away from XML."

That's the point....this is a good thing. XML wasn't designed to be a scripting language... Try doing iterations or if-then conditions with XML . You can do it, but it's awfully painful. Writing your own custum tasks is a pain compared to just utilizing a scripting language.

  Message #224502 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Beanshell *rulez*

Posted by: Phil Swenson on December 22, 2006 in response to Message #224501
I retract my comment after reading your reply again :)

  Message #243738 Post reply Post reply Post reply Go to top Go to top Go to top

XML as script is bad..

Posted by: Per Arneng on December 14, 2007 in response to Message #224218
It is a hell of a lot harder to have good AntXML files for large J2EE (200k+ loc) projects then small apps.. AntXML works great when its just some simple declared targets but when the files grow and you start to have alot of imported AntXML files and dependencies and conditionals then you tend to get a mess..

I have done some testing with BeanShell and Groovy with Ant and it works excelent.. BeanShell and Groovy are so tightly integrated with java and the languages are very java like so i think there is a smaller step to learn those then to learn AntXML.

Also learning a scripting language is not a burden but a lot of fun.

XML is not good as a scripting language.. It was not designed to be used that way.. that is why AntXML (when used advanced) and XSLT suck bigtime..

Ant's tasks are however great so a combination of a powerfull but readable scripting language (that is easy to learn for java programmers) we have a winning combination.

New content on TheServerSide.comNew content on TheServerSide.comNew content on TheServerSide.com

Dependency Injection in Java EE 6 - Part 2

Reza Rahman continues to explore the features of the proposed JSR 299, Contexts and Dependency Injection for Java EE (CDI). When approved, it promises to be a key feature of Java EE 6. (January 21, Article)

Ted Neward Q&A: What you must know about JavaScript, Scala and more

Ted Neward is an independent consultant specializing in high-scale enterprise systems, and an authority in Java and .NET technologies. He is the author and co-author of several books, including Effective Enterprise Java. At TheServerSide Java Symposium in March, he will be presenting sessions on pragmatic architecture, ECMAScript and Scala. (January 15, Article)

Developers split on open sourcing Java

Now that Oracle is absorbing Sun Microsystems, there mixed views on what should come of the Java Community Process (JCP). While some say Oracle should become the new steward of Java and keep the JCP much as it was, others argue that it may be time to open-source this widespread language. (November 24, Article)

Dependency Injection in Java EE 6 - Part 1

Reza Rahman explores the features of the proposed JSR 299, Contexts and Dependency Injection for Java EE (CDI). When approved, it promises to be a key feature of Java EE 6. (November 2, Article)

SAML: It's Not just for Web services

SAML is an XML-based standard for exchanging authentication and authorization data between security domains. The single most important problem that SAML was created to solve is the Web browser Single Sign-On problem. Many organizations are debating whether to stay with version 1.1 or move to 2.0. This article makes observations about both options. (September 28, Article)

Programming is Also Teaching Your Team

Joe Ottinger takes a look at how people learn, and applies it to the practice of programming. He notes that understanding how people learn is an essential part of working in a programming team. (September 22, Article)

Can Java EE Deliver The Asynchronous Web?

Stephen Maryka gave us an article about the Asynchronous Web and posed a number of questions that get examined like an approach to delivering Asynchronous Web capabilities through extensions to existing Java EE technologies. (July 14, Article)

JSF Flex

JavaServer Faces Flex goal is to provide users capability in creating standard Flex components, part of flexSDK which is open sourced through MPL license, as normal JSF components. This article by Ji Hoon Kim will provide an overview of creating a simple multilingual JSF page consisting of JSF Flex tags. (June 29, Article)

The Rules of SOA - A Road to a Successful SOA Implementation

In this session Jeff explores the key characteristics of successful SOA projects. He covers some of the patterns, and anti-patterns, tool sets, and strategies that he himself learned the hard way. Last, he provides a strategy and blueprint for achieving a high likelihood of success in your SOA project. (June 23, Tech Talk)

Ari Zilka Talks About Terracotta 3.1

Ari Zilka, CTO of Terracotta, Inc., talks about the new features in Terracotta 3.1, announced during JavaOne and available now. (June 15, Tech Talk)

Enterprise Application Integration, and Spring

In this Tech Talk, Josh Long explores an integration challenge using Spring Integration and walks through the implementation, employing and expanding on the basic patterns of Enterprise Application Integration to tie together components into a function integration solution, and then demonstrates how Spring Integration helps address the integration requirements. (June 15, Tech Talk)

Google Web Toolkit: An Introduction

In this Tech Talk, David Geary teaches you: The basics of Google Web Toolkit; How to implement Ajax-enabled applications in Java; Internationalization; Hooking into the browser history mechanism; Remote procedure calls. (June 4, Tech Talk)

Just Enough Early Architecture to Guide Development

Jon Kern discusses the best architecture/technical solutions and ensure that they are repeated by all developers. By tackling the architecture up-front in a serial manner, subsequent parallel development will be much more manageable and predictable. (May 28, Tech Talk)

Productive Programmer: On the Lam from the Furniture Police

This keynote describes the frustrations of modern knowledge workers in their quest to actually get some work done, and solutions for how to guard yourself against all those distractions. Neal Ford talks about environments, coding, acceleration, automation, and avoiding repetition as ways to defeat the misguided attempts to sap your ability to produce good work. (May 26, Tech Talk)

Auto-Scaling Your Existing Web Application

Gil demonstrates how new, aggressive uses of already abundant compute capacity by common applications offer competitive value for application designers. (May 21, Tech Talk)

Automating Hibernate Mapping and Queries For Java Web Development

Chris Keene introduces WaveMaker as a new way to automate the ability to generate Hibernate classes in order to more quickly bring OR mapping into an application. (May 19, Article)

Free Book: Jakarta-Struts Live

Download the entire book of Jakarta-Struts Live and learn about Struts MVC, Tiles, the Validator, DynaActionForms, plug-ins, internationalization, and more.
(Book PDF Download)

Application Server Matrix

The Application Server Matrix is a detailed listing of J2EE vendors and their application server products, with information on latest version numbers, J2EE spec support and licensing, pricing, platform support, and links to product downloads and reviews.
(Application Server Comparison Matrix)

News | Blogs | Discussions | Tech talks | Patterns | Reviews | White Papers | Downloads | Articles | Media kit | About
Java Solutions
All Content Copyright ©2007 TheServerSide Privacy Policy
Site Map