Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.6.5
-
Fix Version/s: JRuby 1.7.0.pre1
-
Component/s: HelpWanted, Intro, Java Integration
-
Labels:
-
Environment:RHEL6
-
Number of attachments :
Description
When trying to re-use a pre-built build.xml file, the following code is used:
def exec_ant(arg_list) ant arg_list end
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).
If using another environment variable is the right solution, $ANT_HOME looks like the right one to use.
The Ant executable can be accessed via $ANT_HOME/bin.