JRuby (please use github issues at http://bugs.jruby.org)
  1. JRuby (please use github issues at http://bugs.jruby.org)
  2. JRUBY-6250

When executing an Ant build.xml file, the Ant executable should not be required to live on the environment's $PATH

    Details

    • Number of attachments :
      0

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

        Activity

        Hide
        Sadique Ali added a comment - - edited

        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.

        Show
        Sadique Ali added a comment - - edited 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.
        Hide
        Hiro Asari added a comment -

        Fixed in master: 1c377ee

        If $ANT_HOME is set, we call $ANT_HOME/bin/ant instead.

        Show
        Hiro Asari added a comment - Fixed in master: 1c377ee If $ANT_HOME is set, we call $ANT_HOME/bin/ant instead.

          People

          • Assignee:
            Hiro Asari
            Reporter:
            John Ryding
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: