mkristian / jar-dependencies

manage jar dependencies for ruby gems
MIT License
34 stars 19 forks source link

Error on TravisCI with jruby 9.1.5.0 (2.3.1), works with jruby-1.7.25 #52

Open mikebski opened 7 years ago

mikebski commented 7 years ago

I'm getting an error on TravisCI with jruby 1.7.25, but jruby:

Gem::LoadError: You have already activated jar-dependencies 0.3.5, but your Gemfile requires jar-dependencies 0.3.9. Prependingbundle execto your command may solve this.

I have this in my gemfile: gem "jar-dependencies", "~> 0.3.9"

Here's the output from the working one: https://travis-ci.org/mikebski/logstash-filter-collect/jobs/190958310

Here's the non-working one: https://travis-ci.org/mikebski/logstash-filter-collect/jobs/190958311

Any ideas?

mkristian commented 7 years ago

that is strange. hard to say. I it just the head of your repo I will need to dig into this. we had this problem before that something is activating jar-dependencies inside bundler (probably some rubygems code) and then there is this conflict.

do you need jar-dependencies 0.3.9 ? because of the proxy stuff ? not sure if you really need it.

next jruby-9k version will have 0.3.9 bundled.

I am travelling the next two days, not sure if I find time over the weekend. so do not expect a fix this week

mikebski commented 7 years ago

Now worries, it actually works on my laptop with both versions of Ruby (using rvm) no problem. I'm just not sure why it's not working on TCI. Also, I do not check in the Gemfile.lock. It is a Logstash plugin and the plugin installs properly and works, but I'm curious now since I cannot seem to figure it out. Please let me know if you need anything else when you get to this.

detj commented 7 years ago

I am getting the same error on GitLab CI

bundler: failed to load command: jbundle
Gem::LoadError: You have already activated jar-dependencies 0.3.5, but your Gemfile requires jar-dependencies 0.3.11. Prepending `bundle exec` to your command may solve this.
  /opt/jruby/lib/ruby/gems/shared/gems/bundler-1.14.5/lib/bundler/runtime.rb:40:in `block in setup'
  org/jruby/RubyArray.java:1734:in `each'
  org/jruby/RubyEnumerable.java:829:in `map'
  /opt/jruby/lib/ruby/gems/shared/gems/bundler-1.14.5/lib/bundler/runtime.rb:25:in `setup'
  /opt/jruby/lib/ruby/gems/shared/gems/bundler-1.14.5/lib/bundler.rb:100:in `setup'
  /opt/jruby/lib/ruby/gems/shared/gems/bundler-1.14.5/lib/bundler/setup.rb:20:in `<main>'
  org/jruby/RubyKernel.java:959:in `require'
  /opt/jruby/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55:in `require'

This error occurs when CI executes this

$ bundle exec jbundle install --vendor

This error goes away if I set the version of jar-dependencies in Gemfile.lock to 0.3.5. But, this is not a solution. I tried out installing ruby-maven, ~> 3.3.11 as a dev dependency as asked by the post install message, but that didn't work.

Anything else I can try out to better debug ? no idea what's going on, actually Works fine on localhost.

Using jruby v9.1.6.0

mkristian commented 7 years ago

question: is this q rvm based build ? do you rvm locally ?

really hard to debug

detj commented 7 years ago

@mkristian I use rbenv locally.

mkristian commented 7 years ago

@detj thanks, I try rvm - maybe I can reproduce it. any particular reason to use jbundler over jar-dependencies ? jar-dependencies comes with lock_jars which uses the same Jarfile and can vendor jars as well.

do you need to vendor the jars during build ? they just get copied to some other locations.

detj commented 7 years ago

@mkristian So, I need a few Jars from a maven repository. I also have a Jarfile & Jarfile.lock.

mkristian commented 7 years ago

@detj lock_jars will produce a Jars.lock but the Jarfile is the same. I doubt (judging from afar) that you need to vendor your jars for the tests. btw jbundler uses jars-dependencies so does lock_jars. still need to look into this issue though :(

detj commented 7 years ago

@mkristian yes, correct. need to vendor the jars for the tests.

detj commented 7 years ago

@mkristian Here is a portion of my Gemfile.lock if this can be of any help

    ice_nine (0.11.2)
    jar-dependencies (0.3.11)
    jbundler (0.9.3)
      bundler (~> 1.5)
      jar-dependencies (~> 0.3)
      maven-tools (~> 1.1)
      ruby-maven (~> 3.3, >= 3.3.8)
    jdbc-postgres (9.4.1206)

I'm using jruby 9.1.6.0 and jar-dependencies comes with it. Maybe thats where the issue lies?

jsvd commented 7 years ago

we're seeing this also in logstash in many places (e.g. https://travis-ci.org/logstash-plugins/logstash-patterns-core/jobs/265018856#L440-L451) , the easiest way to reproduce is:

/tmp/jars_deps % ruby -v
jruby 9.1.10.0 (2.3.3) 2017-05-25 b09c48a Java HotSpot(TM) 64-Bit Server VM 25.111-b14 on 1.8.0_111-b14 +jit [darwin-x86_64]
/tmp/jars_deps % gem list -a jar-dependencies

*** LOCAL GEMS ***

jar-dependencies (default: 0.3.9)
/tmp/jars_deps % ls
Gemfile
/tmp/jars_deps % cat Gemfile
source "https://rubygems.org"

gem "jar-dependencies"
/tmp/jars_deps % bundle install --path=vendor
Fetching gem metadata from https://rubygems.org/.......
Fetching version metadata from https://rubygems.org/.
Resolving dependencies...
Using bundler 1.15.3
Fetching jar-dependencies 0.3.11
Installing jar-dependencies 0.3.11
Bundle complete! 1 Gemfile dependency, 2 gems now installed.
Bundled gems are installed into ./vendor.
Post-install message from jar-dependencies:

if you want to use the executable lock_jars then install ruby-maven gem before using lock_jars 

   $ gem install ruby-maven -v '~> 3.3.11'

or add it as a development dependency to your Gemfile

   gem 'ruby-maven', '~> 3.3.11'

/tmp/jars_deps % bundle exec rspec
bundler: failed to load command: rspec (/Users/joaoduarte/.rvm/gems/jruby-9.1.10.0/bin/rspec)
Gem::LoadError: You have already activated jar-dependencies 0.3.9, but your Gemfile requires jar-dependencies 0.3.11. Since jar-dependencies is a default gem, you can either remove your dependency on it or try updating to a newer version of bundler that supports jar-dependencies as a default gem.
  /Users/joaoduarte/.rvm/gems/jruby-9.1.10.0/gems/bundler-1.15.3/lib/bundler/runtime.rb:317:in `check_for_activated_spec!'
  /Users/joaoduarte/.rvm/gems/jruby-9.1.10.0/gems/bundler-1.15.3/lib/bundler/runtime.rb:32:in `block in setup'
  org/jruby/RubyArray.java:1734:in `each'
  org/jruby/RubyEnumerable.java:830:in `map'
  /Users/joaoduarte/.rvm/gems/jruby-9.1.10.0/gems/bundler-1.15.3/lib/bundler/runtime.rb:27:in `setup'
  /Users/joaoduarte/.rvm/gems/jruby-9.1.10.0/gems/bundler-1.15.3/lib/bundler.rb:101:in `setup'
  /Users/joaoduarte/.rvm/gems/jruby-9.1.10.0/gems/bundler-1.15.3/lib/bundler/setup.rb:9:in `<main>'
  org/jruby/RubyKernel.java:961:in `require'
  /Users/joaoduarte/.rvm/rubies/jruby-9.1.10.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:54:in `require'
mkristian commented 7 years ago

@jsvd since I am basically offline until end of August - I can not have a look.