从源 Jruby 和 Buildr 构建 apache ODE

Building apache ODE from the source Jruby and Buildr

我需要从源代码构建 apache ODE 1.3.5。从源代码构建对我来说很重要,因为我们计划对 ODE 代码进行一些更改。我尝试了他们的 instructions 来构建。我能够安装 jruby 1.5.1,但无法使用上述版本的 jruby 安装 buildr 1.4.4。我在谷歌上搜索了一下,似乎我必须升级到 jruby 1.6.2。在 jruby(1.6.2) 的较新版本之后,我能够安装 buildr 1.4.4 但是当我转到 ODE 源的根目录并执行以下命令时

buildr package test=no

我在控制台上得到以下异常

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

我不知道我做错了什么。这是我与 jruby 以及 buildr 的第一次互动。我感谢任何关于构建此存储库的指示。

编辑 1: 下面是安装 jruby 1.7.13buildr 1.4.19

jruby -S gem list 的结果
C:\Users030053.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:\Users030053.CS-6606-DT>

编辑 2 当我在 apache-ode-sources-1.3.5 中执行命令 buildr package test=no --trace 时,出现以下错误

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>

下面是@sathwik 在 apache-ode 邮件列表上的回复,它帮助我编译版本 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.