replacing maven with rake + rjb + ant

T

thebox

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 Fowler 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] ==> http://www.martinfowler.com/articles/rake.html
[2] ==>
http://jira.codehaus.org/browse/HAUS-211;jsessionid=asvbK6wlqWt7H6hWmN?actionOrder=desc
[3] ==> http://ant-contrib.sourceforge.net/
 
D

David Vallner

--------------enigD46C9D0DE84222ACC3CE6856
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Tanner said:
A better idea would be to rely on ant and of course you want to do it
in an efficient manner. As Martin Fowler mentioned in his article [1],=
best way would be to run ant as a server, so that you don't have to pa= y
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. <insert comment
about ThoughtWorks consultants and no need of attention span here>
=20
=20
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 o= n 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.
=20
[1] http://jruby.codehaus.org/
=20

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 Vallner


--------------enigD46C9D0DE84222ACC3CE6856
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)

iD8DBQFFednay6MhrS8astoRAq3yAJ4nV8oSsSh8UFUNt+zlOVew3pHOOgCfRCA2
LpRf45ohSyTF3dVzPARRN1A=
=6+to
-----END PGP SIGNATURE-----

--------------enigD46C9D0DE84222ACC3CE6856--
 
T

thebox

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
 
D

David Vallner

--------------enig831E781C88E5DC00F0BA7915
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
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.
=20

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).
=20

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 Vallner


--------------enig831E781C88E5DC00F0BA7915
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)

iD8DBQFFetfBy6MhrS8astoRAqKkAJsE/hPNHzg+pDo2sWnWwRdI/lr7agCdET7V
W28TV0P1a3kak0Nip2upfJo=
=Bga9
-----END PGP SIGNATURE-----

--------------enig831E781C88E5DC00F0BA7915--
 
T

thebox

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
 
C

Charles Oliver Nutter

thebox said:
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.

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.
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.

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.
 
T

thebox

Hi Charles.

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
 
C

Caleb Powell

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.
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 Fowler 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] ==> http://www.martinfowler.com/articles/rake.html
[2] ==>
http://jira.codehaus.org/browse/HAUS-211;jsessionid=asvbK6wlqWt7H6hWmN?actionOrder=desc
[3] ==> http://ant-contrib.sourceforge.net/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top