When trying to re-use a pre-built build.xml file, the following code is used:
When executed in this way, JRuby's Ant library makes a shell call to execute Ant. This is done at lib/ruby/site_ruby/shared/ant/ant.rb:172.
The problem is that the path to the ant executable (e.g. /opt/apache-ant/bin) is required to live on the environment's $PATH. This is a problem for systems that get automatically deployed by configuration management systems like Chef because is is difficult for a script to permanently set the $PATH variable to live on after its process is done. Also, external systems like build engines may screw up the $PATH. For example, the build system that my team uses sets its own $PATH when it executes a new build, which requires us to have our scripts explicitly know where the Ant binary lives in order to utilize Jruby+Ant.
A better method to execute ant from an sh command would be to use some other environment variable the same way Java is required to ($JAVA_HOME).