Uploaded image for project: 'Buildr (Retired)'
  1. Buildr (Retired)
  2. BUILDR-567

Enable Ant using JRuby's Ant integration

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Later
    • 1.4.4
    • 1.5
    • JRuby
    • None

    Description

      Buildr does not work with JRuby's Ant integration. Since Antwrap hasn't been updated in almost three years, I tried to follow the JRuby + Ant examples in the article linked at the end. This simple script works using just jruby:

      1. test.rb
        require 'ant' # Use JRuby Ant integration

      puts ant.properties['ant.version']
      puts ant.properties['ant.core.lib']

      But when I try accessing ant from Buildr, I keep getting a TypeError that complains about Ant not being a class. This buildfile:

      1. buildfile - buildr sandbox
        VERSION_NUMBER = "1.0.0"
        GROUP = "buildr-sandbox"

      require 'ant'

      repositories.remote << "http://www.ibiblio.org/maven2/"

      desc "The Buildr-sandbox project"

      define "buildr-sandbox" do
      project.version = VERSION_NUMBER
      project.group = GROUP

      package :jar
      end

      Results in this error:

      Buildr aborted!
      TypeError : Ant is not a class
      .../jruby/lib/ruby/site_ruby/shared/ant.rb:3:in `(root)'
      org/jruby/RubyKernel.java:1041:in `require'
      .../jruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `require'
      .../jruby/lib/ruby/site_ruby/shared/ant.rb:6:in `(root)'
      org/jruby/RubyKernel.java:1066:in `load'
      .../buildr-sandbox/buildfile:412:in `raw_load_buildfile'
      .../jruby-1.6.0.RC1/lib/ruby/gems/1.8/gems/buildr-1.4.4-java/lib/buildr/core/application.rb:218:in `load_buildfile'
      .../jruby-1.6.0.RC1/lib/ruby/gems/1.8/gems/buildr-1.4.4-java/lib/buildr/core/application.rb:523:in `standard_exception_handling'
      .../jruby-1.6.0.RC1/lib/ruby/gems/1.8/gems/buildr-1.4.4-java/lib/buildr/core/application.rb:213:in `load_buildfile'
      .../jruby-1.6.0.RC1/lib/ruby/gems/1.8/gems/buildr-1.4.4-java/lib/buildr/core/application.rb:137:in `run'
      .../jruby-1.6.0.RC1/lib/ruby/gems/1.8/gems/buildr-1.4.4-java/lib/buildr/core/application.rb:523:in `standard_exception_handling'
      .../jruby-1.6.0.RC1/lib/ruby/gems/1.8/gems/buildr-1.4.4-java/lib/buildr/core/application.rb:135:in `run'
      .../jruby-1.6.0.RC1/lib/ruby/gems/1.8/gems/buildr-1.4.4-java/bin/buildr:19:in `(root)'
      org/jruby/RubyKernel.java:1066:in `load'

      I think it's because $JRUBY_HOME/lib/ruby/site_ruby/shared/ant.rb defnes Ant as a class while lib/buildr/java/ant.rb, which runs first (I think) defines it as a module.

      The article: http://www.engineyard.com/blog/2010/rake-and-ant-together-a-pick-it-n-stick-it-approach/

      Attachments

        Activity

          People

            toulmean Antoine Toulme
            deridex David
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: