Enable Ant using JRuby's Ant integration
----------------------------------------

                 Key: BUILDR-567
                 URL: https://issues.apache.org/jira/browse/BUILDR-567
             Project: Buildr
          Issue Type: Improvement
          Components: JRuby
    Affects Versions: 1.4.4
            Reporter: David


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:

# 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:


# 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/


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to