Search code examples
jrubybuildrapache-ode

Building apache ODE from the source Jruby and Buildr


I need to build apache ODE 1.3.5 from the source. Building from the source is important for me because we plan to make some changes in the ODE code. I tried out their instructions for building. I was able to install jruby 1.5.1 but I was not able to install buildr 1.4.4 using the said version of jruby. I googled a bit and it seemed like I had to upgrade to jruby 1.6.2. After the newer version of jruby(1.6.2), I was able to install buildr 1.4.4 but when I go to the root of the ODE source and execute the following command

buildr package test=no

I get the below exceptions on the console

LoadError: no such file to load -- rubygems/source_info_cache
  require at org/jruby/RubyKernel.java:1038
  require at c:/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29
   (root) at c:/jruby-1.6.2/lib/ruby/gems/1.8/gems/buildr-1.4.4-java/lib/buildr/core/application.rb:41
  require at org/jruby/RubyKernel.java:1038
  require at c:/jruby-1.6.2/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29
   (root) at c:/jruby-1.6.2/lib/ruby/gems/1.8/gems/buildr-1.4.4-java/lib/buildr/core/application.rb:17
  require at org/jruby/RubyKernel.java:1038
  require at c:/jruby-1.6.2/lib/ruby/gems/1.8/gems/buildr-1.4.4-java/lib/buildr/core.rb:29
   (root) at c:/jruby-1.6.2/lib/ruby/gems/1.8/gems/buildr-1.4.4-java/lib/buildr.rb:20
  require at org/jruby/RubyKernel.java:1038
  require at c:/jruby-1.6.2/lib/ruby/gems/1.8/gems/buildr-1.4.4-java/lib/buildr.rb:29
   (root) at c:/jruby-1.6.2/lib/ruby/gems/1.8/gems/buildr-1.4.4-java/bin/buildr:18
     load at org/jruby/RubyKernel.java:1063
   (root) at c:\jruby-1.6.2\bin\buildr:19

I have no idea what I am doing wrong. This is my first interaction with jruby as well as buildr. I appreciate any pointers towards the building of this repository.

Edit 1: Below is the result of jruby -S gem list after installing jruby 1.7.13 and buildr 1.4.19

C:\Users\16030053.CS-6606-DT>jruby -S gem list

*** LOCAL GEMS ***

atoulme-Antwrap (0.7.5 java)
bouncy-castle-java (1.5.0147)
builder (3.2.2)
buildr (1.4.19 java)
bundler (1.15.3)
diff-lcs (1.2.4)
ffi (1.9.3 java)
hoe (3.7.1)
jruby-openssl (0.9.5 java, 0.8.10)
jruby-pageant (1.1.1 java)
jruby-win32ole (0.8.5)
json (1.8.0 java)
json_pure (1.8.0)
krypt (0.0.2)
krypt-core (0.0.2 universal-java)
krypt-provider-jdk (0.0.2)
minitar (0.5.4)
net-sftp (2.1.2)
net-ssh (2.7.0)
orderedhash (0.0.6)
rake (10.1.0, 0.9.2.2)
rdoc (4.0.1)
rspec (2.14.1)
rspec-core (2.14.5)
rspec-expectations (2.14.3)
rspec-mocks (2.14.3)
rubyzip (0.9.9)
xml-simple (1.1.2)

C:\Users\16030053.CS-6606-DT>

Edit 2 When I execute the command buildr package test=no --trace in apache-ode-sources-1.3.5, I get the following errors

F:\apache-ode-sources-1.3.5>buildr package test=no --trace
Buildr aborted!
SyntaxError : F:/apache-ode-sources-1.3.5/tasks/jbi.rake:79: formal argument cannot be an instance variable
        Tempfile.open("MANIFEST.MF") { |@jbi_xml_tmp| @jbi_xml_tmp.write descriptor }
                                                   ^
org/jruby/RubyKernel.java:1081:in `load'
c:/jruby-1.7.13/lib/ruby/gems/shared/gems/buildr-1.4.19-java/lib/buildr/core/application.rb:1:in `(root)'
org/jruby/RubyArray.java:1613:in `each'
c:/jruby-1.7.13/lib/ruby/gems/shared/gems/buildr-1.4.19-java/lib/buildr/core/application.rb:497:in `load_tasks'
c:/jruby-1.7.13/lib/ruby/gems/shared/gems/buildr-1.4.19-java/lib/buildr/core/application.rb:494:in `load_tasks'
c:/jruby-1.7.13/lib/ruby/gems/shared/gems/buildr-1.4.19-java/lib/buildr/core/application.rb:224:in `load_buildfile'
c:/jruby-1.7.13/lib/ruby/gems/shared/gems/buildr-1.4.19-java/lib/buildr/core/application.rb:535:in `standard_exception_handling'
c:/jruby-1.7.13/lib/ruby/gems/shared/gems/buildr-1.4.19-java/lib/buildr/core/application.rb:220:in `load_buildfile'
c:/jruby-1.7.13/lib/ruby/gems/shared/gems/buildr-1.4.19-java/lib/buildr/core/application.rb:130:in `run'
c:/jruby-1.7.13/lib/ruby/gems/shared/gems/buildr-1.4.19-java/lib/buildr/core/application.rb:535:in `standard_exception_handling'
c:/jruby-1.7.13/lib/ruby/gems/shared/gems/buildr-1.4.19-java/lib/buildr/core/application.rb:128:in `run'
org/jruby/RubyKernel.java:1081:in `load'
c:\jruby-1.7.13\bin\buildr:23:in `(root)'

F:\apache-ode-sources-1.3.5>

Solution

  • Below is the response of @sathwik on apache-ode mailing list that helped me compile the ode source for version 1.3.5

    Hi Muhammad,

    Use jruby 1.7.13 and buildr 1.4.19

    Edit file <ode 1.3.5 source>/tasks/jbi.rake. Find and Replace the initialize method with the content below

      def initialize(*args)
        super
        prepare { path("lib").include((component.libs +
    bootstrap.libs).flatten.uniq) }
    
        enhance do
          case jbi_xml
          when String
            path("META-INF").include jbi_xml.path, :as=>"jbi.xml"
          when nil, true
            # Tempfiles gets deleted on garbage collection, so we're going to
    hold on to it
            # through instance variable not closure variable.
            @jbi_xml_tmp = Tempfile.new('MANIFEST.MF')
            @jbi_xml_tmp.write descriptor
            path("META-INF").include @jbi_xml_tmp.path, :as=>"jbi.xml"
            @jbi_xml_tmp.close
          when Proc, Method
            @jbi_xml_tmp = Tempfile.new('MANIFEST.MF')
            @jbi_xml_tmp.write jbi_xml.call.to_s
            path("META-INF").include @jbi_xml_tmp.path, :as=>"jbi.xml"
            @jbi_xml_tmp.close
          end
        end
      end
    

    Besides the above changes I had to change line 37 of dependencies.rb file from

    AXIS2_WAR           = "org.apache.axis2:axis2-webapp:war:1.3" to
    
    AXIS2_WAR           = "org.apache.axis2:axis2-webapp:war:1.6.2"
    

    The above change was needed because all the repositories containing reference to axis2-webapp:war:1.3 are down. Furthermore, you need to add following line at the end of repositories.rb file

    repositories.remote << "http://people.apache.org/~vanto/m2/"
    

    This is required to fulfill one of the required dependencies namely xdoclet:xjavadoc-1.1-j5.