Replacing maven with rake + rjb + ant

Hi!

We do 99.999% of our development in java. Our system is a complex J2EE
distributed application currently (poorly) managed with maven. Now, I
don’t want to get into the reasons for doing this, but we have
struggled enough to seriously consider replacing maven with some decent
build tool.

Of course, rake is attractive because it has real file-dependant tasks,
it supports both declarative and imperative programming styles and
today I think we may stick with it, waiting for eventually more
maturity from rant.

The point of this post though is that we would like to find a way to
coordinate common java task (like compiling, jaring, waring, deploying
in containers, etc.) without reinventing the wheel. An obvious choice
would be to piggy back on maven through system calls, but my ambitions
are bigger than that, because I want to break the addiction with maven
repository dependency management structure.

A better idea would be to rely on ant and of course you want to do it
in an efficient manner. As Martin F. mentioned in his article [1],
best way would be to run ant as a server, so that you don’t have to pay
jvm initialization startup time for any call. Apparently, Jon Tirsen
has never released his code (or I wasn’t able to find it). I’ve only
found an old “proof of concept” in codehaus [2]. I’m looking for
something more solid than that.

Ant can be effectively driven like a server, by simply using an
extension like Ant-Contrib [3]. The only problem is that if you use
Ant-Contrib as it is, the protocol between a client and an ant server
relies on java object serialization, making it practically useless from
the ruby world (you don’t really want to reproduce the java object
serialization protocol in ruby, do you?!?).

Hence, I’m currently thinking about using rjb to instantiate
client-side Ant-Contrib java classes from rake and then understand if I
can let the jvm dealing with socket communication, or I serialize java
objects on a bytestream and let ruby handle the communication over the
socket. This is in theory, of course, because I’ve never used rjb
before and I don’t know how easy, manageable and fast it is.

What do you guys think about it? Anybody has any experience around
stuff like this? Alternatives?

Thanks
Giuliano

[1] ==> Using the Rake Build Language
[2] ==>
http://jira.codehaus.org/browse/HAUS-211;jsessionid=asvbK6wlqWt7H6hWmN?actionOrder=desc
[3] ==> http://ant-contrib.sourceforge.net/

On 12/8/06, thebox [email protected] wrote:

it supports both declarative and imperative programming styles and
A better idea would be to rely on ant and of course you want to do it
relies on java object serialization, making it practically useless from
What do you guys think about it? Anybody has any experience around
stuff like this? Alternatives?

I don’t know the full status of it, but there is a Ruby implementation
targetting the JVM. I’m unsure of whether Rake has been made to work on
it
yet, but it could be a great tool in the very least at calling into Ant
without adding the overhead of another JVM initialization.

[1] http://jruby.codehaus.org/

Thanks

have you checked raven?
http://raven.rubyforge.org/

Tanner B. wrote:

A better idea would be to rely on ant and of course you want to do it
in an efficient manner. As Martin F. mentioned in his article [1],
best way would be to run ant as a server, so that you don’t have to pay
jvm initialization startup time for any call. Apparently, Jon Tirsen
has never released his code (or I wasn’t able to find it). I’ve only
found an old “proof of concept” in codehaus [2]. I’m looking for
something more solid than that.

I could throw such a hissy fit targetting those names, but I’ll forgo on
that for once. Suffice it to say that I’m not surprised in the least at
Jon Tirsen couldn’t manage to finish some code between pouncing on the
next random shiny object and then making sure everyone knows that he had
the very same experience as everyone who did so before.

I don’t know the full status of it, but there is a Ruby implementation
targetting the JVM. I’m unsure of whether Rake has been made to work on it
yet, but it could be a great tool in the very least at calling into Ant
without adding the overhead of another JVM initialization.

[1] http://jruby.codehaus.org/

Apparently, http://www.infoq.com/news/JRuby-0.9-Released-Enebo states
that Rake started to work as of the time of writing that article.

This is such an eminently Good Idea I wonder why I didn’t think of it
before, managing ugly builds using JRuby makes somehow inherent sense.

So. JRuby-specific rake extensions that would let you use existing ant
tasks. Anyone?

David V.

On Dec 8, 4:32 pm, David V. [email protected] wrote:

This is such an eminently Good Idea I wonder why I didn’t think of it
before, managing ugly builds using JRuby makes somehow inherent sense.

So. JRuby-specific rake extensions that would let you use existing ant
tasks. Anyone?

Yeah, I though about something like that, but I’ve also realised that
it’s probably better to stick with the ruby interpreter and bridge to
java when needed rather than viceversa. I may be wrong, of course.

Apart from the pleasure of working with ruby, if there was a make for
groovy, with real file dependencies, I would have probably chosen that
(ant task can be very easily called in groovy).

Giuliano

thebox wrote:

Yeah, I though about something like that, but I’ve also realised that
it’s probably better to stick with the ruby interpreter and bridge to
java when needed rather than viceversa. I may be wrong, of course.

Erm. -Technically-, that’s what JRuby is all about. A Ruby interpreter
with an integrated Java bridge. It’s just that the direct integration is
/ will be probably less iffy if you a) can bear with the Ruby
implementation per se lagging (for now?) in completeness / stability,
and b) need a lot of it (as you would in this case, with rake driving
the build process, and the ant tasks doing the heavy lifting, as I
imagine things). There’s probably less integration gotchas involved as
with Java bridges that have two garbage collectors running in parallel.

Apart from the pleasure of working with ruby, if there was a make for
groovy, with real file dependencies, I would have probably chosen that
(ant task can be very easily called in groovy).

I have Issues with Groovy, and wouldn’t use it for anything because of
those to avoid showing any support whatsoever; apart from the fact I
don’t really like it personally as a programming language. The JSR was a
way too underhanded stunt, and would probably mean I’d end up being
forced to program in Groovy (because it would be “standard”) sooner or
later.

David V.

On Dec 9, 10:35 am, David V. [email protected] wrote:

Erm. -Technically-, that’s what JRuby is all about. A Ruby interpreter
with an integrated Java bridge. It’s just that the direct integration is
/ will be probably less iffy if you a) can bear with the Ruby
implementation per se lagging (for now?) in completeness / stability,

Exactly my point. I’d rather stick with “the” interpreter, rather with
“an” intepreter. Basically, I like the idea of using best environments
of both worlds (ruby interpreter and jvm via jni). It may just be a
suggestion, anyway, I should really try both approaches, if I have a
chance. I suspect that raven, if successful, will influence my
decision.

and b) need a lot of it (as you would in this case, with rake driving
the build process, and the ant tasks doing the heavy lifting, as I
imagine things). There’s probably less integration gotchas involved as
with Java bridges that have two garbage collectors running in parallel.

This is actually a valid point. I’m not up to date with JRuby,
therefore I don’t know the details of its garbage collector, but I
suspect that this issue is not easily solved even taking the JRuby
approach. How well are ruby objects, backed by java objects, ultimately
collected by jvm gc? Answering this question may heavily influence
cross-language issues like mine.

Giuliano

thebox wrote:

chance. I suspect that raven, if successful, will influence my
decision.

You should definitely try it with JRuby, since you won’t have the hassle
of either a bridge or an “ant server”. There’s already projects in the
works to make ant easier using Ruby (the antbuilder project hosted in
the jruby-extras project on rubyforge, for example), and I’m super
interested in making Rake work with Ant tasks for building Java code.
It’s a perfect combination.

collected by jvm gc? Answering this question may heavily influence
cross-language issues like mine.

All Ruby objects are Java objects, and so are handled by the JVM. JRuby
also has true native threading instead of green threads. There are no
object or GC-related issues.

On Dec 8, 3:37 pm, “Selem Delul” [email protected] wrote:

have you checked raven?http://raven.rubyforge.org/

No, and after 2 minutes browsing I can say that it looks very
promising!

I’m gonna give it a try.
Thanks a lot
Giuliano

Hi,

with regards to invoking Ant tasks from a Ruby script, you might like
to look at Antwrap:

Project Page: https://rubyforge.org/projects/antwrap/
Docs: http://antwrap.rubyforge.org/

It is being used by the Raven build tool for Ant tasks, but is also
available as a gem. It currently works on the JRuby interpreter.
However, I have it working in the native (or standard) Ruby
interpreter by using the Ruby Java Bridge. An update for this will be
coming
soon.
On 12/8/06, thebox [email protected] wrote:

today I think we may stick with it, waiting for eventually more
in an efficient manner. As Martin F. mentioned in his article [1],
the ruby world (you don’t really want to reproduce the java object
stuff like this? Alternatives?


Caleb

“There is no theory of evolution, just a list of creatures Chuck
Norris allows to live.”

Hi Charles.

On Dec 10, 10:54 am, Charles Oliver N. [email protected]
wrote:

You should definitely try it with JRuby, since you won’t have the hassle
of either a bridge or an “ant server”. There’s already projects in the
works to make ant easier using Ruby (the antbuilder project hosted in
the jruby-extras project on rubyforge, for example), and I’m super
interested in making Rake work with Ant tasks for building Java code.
It’s a perfect combination.

Thanks Charles, I’ll look into it. At this point, I may restart the
conversation again in the jruby-user mailing list. I’ve made some
experiences with JRuby in the past (I’ve used it to script a live java
application some years ago, I’m not even sure it was release 0.7
already and I’ve even contributed a tiny bit to it) and I’m sure that a
lot of things have changed in these years.
By the way, given that JRuby now is already capable of executing rake
scripts, it is then just a matter of trying to drive antbuilder through
rake tasks executed in JRuby, correct?

Can you tell me something about rake speed in JRuby?

All Ruby objects are Java objects, and so are handled by the JVM. JRuby
also has true native threading instead of green threads. There are no
object or GC-related issues.

That’s very good to hear, thanks.

Giuliano