Skip to content

jruby 9.x jar-dependencies thwarts gem install prereq. to gemspec #3078

@dekellum

Description

@dekellum

As of at least 9.0.0.0.rc1 and the current travis-ci jruby-head, the built in jar-dependencies extension is loading and attempting to interpret a gemspec found in the current directory and even for such commands as gem install. In the case of several of my projects building on travis-ci, I need to run gem install to satisfy a dependency of the project's gemspec, before the gemspec can be successfully loaded. Note this all works fine on MRI ruby as well as jruby 1.7.x.

To reproduce:

% jruby -v
jruby 9.0.0.0.rc1 (2.2.2) 2015-06-10 a0bf3b3 OpenJDK 64-Bit Server VM 25.45-b02 on 1.8.0_45-b14 +jit [linux-amd64]
% jgem uninstall rjack-tarpit # just in case you already have it.
% git clone https://github.com/dekellum/mojibake.git
% cd mojibake
% gem install rjack-tarpit
/usr/local/lib/jruby/jruby-9.0.0.0.rc1/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:1:in `require':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
/usr/local/lib/jruby/jruby-9.0.0.0.rc1/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:1:in `require':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
Gem::LoadError: Could not find 'rjack-tarpit' (~> 2.1) among 27 total gem(s)
Checked in 'GEM_PATH=/home/david/.gem/jruby/2.2.0:/usr/local/lib/jruby/gems', execute `gem env` for more information
            to_specs at /usr/local/lib/jruby/jruby-9.0.0.0.rc1/lib/ruby/stdlib/rubygems/dependency.rb:315
             to_spec at /usr/local/lib/jruby/jruby-9.0.0.0.rc1/lib/ruby/stdlib/rubygems/dependency.rb:324
                 gem at /usr/local/lib/jruby/jruby-9.0.0.0.rc1/lib/ruby/stdlib/rubygems/core_ext/kernel_gem.rb:64
              <eval> at (eval):3
                eval at org/jruby/RubyKernel.java:979
      block in setup at /usr/local/lib/jruby/jruby-9.0.0.0.rc1/lib/ruby/stdlib/jars/maven_exec.rb:33
               chdir at org/jruby/RubyDir.java:324
               setup at /usr/local/lib/jruby/jruby-9.0.0.0.rc1/lib/ruby/stdlib/jars/maven_exec.rb:32
          initialize at /usr/local/lib/jruby/jruby-9.0.0.0.rc1/lib/ruby/stdlib/jars/maven_exec.rb:22
          initialize at /usr/local/lib/jruby/jruby-9.0.0.0.rc1/lib/ruby/stdlib/jars/classpath.rb:10
  require_jars_lock! at /usr/local/lib/jruby/jruby-9.0.0.0.rc1/lib/ruby/stdlib/jar_dependencies.rb:162
   require_jars_lock at /usr/local/lib/jruby/jruby-9.0.0.0.rc1/lib/ruby/stdlib/jar_dependencies.rb:173
         require_jar at /usr/local/lib/jruby/jruby-9.0.0.0.rc1/lib/ruby/stdlib/jar_dependencies.rb:179
         require_jar at /usr/local/lib/jruby/jruby-9.0.0.0.rc1/lib/ruby/stdlib/jar_dependencies.rb:263
               <top> at /usr/local/lib/jruby/jruby-9.0.0.0.rc1/lib/ruby/stdlib/psych_jars.rb:5
             require at org/jruby/RubyKernel.java:940
              (root) at /usr/local/lib/jruby/jruby-9.0.0.0.rc1/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:1
               <top> at /usr/local/lib/jruby/jruby-9.0.0.0.rc1/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:128
             require at org/jruby/RubyKernel.java:940
              (root) at /usr/local/lib/jruby/jruby-9.0.0.0.rc1/lib/ruby/stdlib/psych.rb:3
               <top> at /usr/local/lib/jruby/jruby-9.0.0.0.rc1/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:1
             require at org/jruby/RubyKernel.java:940
             require at /usr/local/lib/jruby/jruby-9.0.0.0.rc1/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:128
              (root) at /usr/local/lib/jruby/jruby-9.0.0.0.rc1/lib/ruby/stdlib/yaml.rb:5
              (root) at /usr/local/lib/jruby/jruby-9.0.0.0.rc1/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:1
             require at /usr/local/lib/jruby/jruby-9.0.0.0.rc1/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:128
           load_yaml at /usr/local/lib/jruby/jruby-9.0.0.0.rc1/lib/ruby/stdlib/rubygems.rb:624
           load_file at /usr/local/lib/jruby/jruby-9.0.0.0.rc1/lib/ruby/stdlib/rubygems/config_file.rb:328
               <top> at /usr/local/bin/jgem:22

Here is a travis build with the problem. Note this also results in a "bundle: command not found" warning/error in that environment:

https://travis-ci.org/dekellum/mojibake/jobs/67886026#L172

Note that supplying the JARS_SKIP environment setting does not avoid this issue. #1974 seemed to suggest that would be a workaround.

A simple/silly workaround is to add an empty 'another.gemspec' to the working directory. Apparently jar-dependencies gives up trying to load a gemspec if there are two files with that extension. Here is a working build with that workaround:

https://travis-ci.org/dekellum/mojibake/jobs/67891335

This is similar to issue #1975 as was previously resolved by jruby/jar-dependencies@0250839. Possibly other fixes in jruby 9, have made this the LoadError is should be, and above referenced fix does not successfully rescue LoadError.

I will provide a pull request fixing this to the jar-dependencies project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions