buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pepijn Van Eeckhoudt <pep...@vaneeckhoudt.net>
Subject Re: Buildr terminates after RJB invocation
Date Wed, 08 Apr 2015 09:44:48 GMT
Ant’s Main class calls System.exit and RJB starts the JavaVM within the Ruby process, not
as a subprocess, so Ant ends up terminating the entire process. Simplest fix is to run Ant
as a subprocess instead of in-process I think.
Alternative solution from an SO answer (http://stackoverflow.com/questions/8714262/invoke-ant-from-java-then-return-to-java-after-ant-termination
<http://stackoverflow.com/questions/8714262/invoke-ant-from-java-then-return-to-java-after-ant-termination>)
is to subclass Ant’s Main and override its exit method to be a noop.

Best regards,

Pepijn

> On 08 Apr 2015, at 09:44, Ander Juaristi <ajuaristi@gmx.es> wrote:
> 
> Hi,
> 
> I've got a legacy ant script called deploy.xml, and I'm running it through a Buildr buildfile,
like this:
> 
>    Java.org.apache.tools.ant.Main.main(['-buildfile', 'deploy.xml'])
> 
> So far it runs OK, but there are a bunch of Ruby lines after it that don't get executed.
The whole Buildr process seems to terminate after the Ant invocation completes.
> 
> I've tried using a separate thread, but nothing changes:
>    t = Thread.new {
>        Java.org.apache.tools.ant.Main.main(['-buildfile', 'deploy.xml'])
>    }
>    t.join
> 
> Finally, I've gone through AntWrap (http://antwrap.rubyforge.org), but looking at the
documentation, it does not seem to be able to run legacy Ant scripts. At least, in a straightforward
way.
> 
> Thoughts?
> 
> -- 
> Regards,
> - AJ


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message