Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Needs to be updated to work with bundler 2.0 #90

Open
mohamedhafez opened this issue Apr 10, 2019 · 12 comments
Open

Needs to be updated to work with bundler 2.0 #90

mohamedhafez opened this issue Apr 10, 2019 · 12 comments
Assignees

Comments

@mohamedhafez
Copy link

Currently, one of the dependencies is bundler ~> 1.5, but bundler 2.0 came out a few months ago.

@Adithya-copart
Copy link

Adithya-copart commented Jun 19, 2019

I tried changing this dependency locally after cloning this repo.

s.add_runtime_dependency "bundler", "~> 1.5"

to

s.add_runtime_dependency "bundler", ">= 1.5", '<= 3'

The tests are all green. However, I had to use bundle _2.0.2_ exec jbundle install over jbundle since I'm using jruby 9.2.7.0 that ships with bundler 1.16.6.

$ rake specs
Run options: --seed 26191

# Running:

...............................

Finished in 3.377386s, 9.1787 runs/s, 42.6365 assertions/s.

31 runs, 144 assertions, 0 failures, 0 errors, 0 skips

@mkristian mkristian self-assigned this Jun 27, 2019
@jeremyhaile
Copy link

Any update here?

@JasonDuckworth
Copy link

Is there any update on this? I noticed there has been a change to fix this issue but the latest release (0.9.3) still won't work with bundler 2.0 and above.

@mufti1
Copy link

mufti1 commented Apr 11, 2020

There are failing spec in the CI

@sixtyfive
Copy link

$ jruby -S jbundle install
...
You must use Bundler 2 or greater with this lockfile.
$ jruby -S bundler --version
Bundler version 2.2.16

Help, please!

@deivid-rodriguez
Copy link

@mkristian I see that you already relaxed the constraint in the default branch to allow bundler 2. Would it be possible to release that? Bundler 2 is used everywhere now.

@jpac-run
Copy link

@mkristian Will there be a release with the relaxed constraint?

@mattwelke
Copy link

I think I ran into this tonight. I was tinkering with jruby, following this tutorial: https://blog.heroku.com/reactive_ruby_building_real_time_apps_with_jruby_and_ratpack. It's an old tutorial, I know, but I figured there'd still be good concepts to learn.

I tried changing the Gemfile provided in the tutorial to use the version of jruby I had installed right now, which is 9.3.0.0. I ran into an error when I ran the jruby -S bundle install --binstubs command:

Bundler could not find compatible versions for gem "bundler":
  In Gemfile:
    jbundler (= 0.9.2) was resolved to 0.9.2, which depends on
      bundler (~> 1.5)

  Current Bundler version:
    bundler (2.2.14)

I was able to install version 1.17.3 of bundle, like the error output suggested, and run it with bundle _1.17.3_ install, which installed the gems while I was running jruby 9.3.0.0. The command jruby -S bundle _1.17.3_ install --binstubs worked too, so it appears that the jruby command passes the parameters through to any underlying programs that need to be invoked correctly. But it feels like there's some friction here. As a newbie, I'm not sure if I'm setting myself up for issues here.

@mohamedhafez
Copy link
Author

mohamedhafez commented Nov 27, 2021

@mattwelke or anybody else, my advice would be to just use gradle and specify your maven dependencies in a build.gradle file. Its not a perfect solution, I'm always worried it'll pull in a java class or version of a library that conflicts with or overwrites something that JRuby itself is using, but jbundler is obviously an abandoned project at this point. For what its worth I haven't had any issues though using gradle to pull in Java libraries to my JRuby projects since 2019.

@mattwelke
Copy link

mattwelke commented Nov 28, 2021

@mohamedhafez Thanks for the update. I found the Jarfile and jbundler approach pretty elegant. It was nice to not have to do a full Maven or Gradle setup and still be able to declaratively list JAR dependencies. But I understand open source needs time invested in it. If it's hard to maintain jbundler, I think it's reasonable to ask JRuby users who want to use JAR dependencies to set up Maven or Gradle instead of using jbundler. I imagine only JRuby users with some knowledge of Java would want to use JARs directly anyways, so it's reasonable to assume they'd know about Maven or Gradle.

I think I know of another way JRuby users can get their JAR dependencies. My understanding so far of JRuby is that it's possible to encapsulate JAR files within Ruby gems, in which case bundler takes care of everything without jbundler, Maven, or Gradle being needed. So perhaps an alternative to developers using Maven and Gradle in their Ruby projects would be to create simple gems that are just wrappers around the JAR dependencies. That way, bundler would then install every dependency, including the JAR files.

In fact, I just tested this by adding gem 'rjack-slf4j', '1.7.25.0' to my Gemfile and running bundle. In the output, I see:

...
Use `bundle info [gemname]` to see where a bundled gem is installed.

If I run bundle info rjack-slf4j, the output is:

  * rjack-slf4j (1.7.25.0)
        Summary: A JRuby adaption and gem packaging of the Simple Logging Facade for Java.
        Homepage: http://rjack.gravitext.com/slf4j
        Path: /home/matt/.rbenv/versions/jruby-9.3.1.0/lib/ruby/gems/shared/gems/rjack-slf4j-1.7.25.0-java

If I run tree /home/matt/.rbenv/versions/jruby-9.3.1.0/lib/ruby/gems/shared/gems/rjack-slf4j-1.7.25.0-java, the output is:

/home/matt/.rbenv/versions/jruby-9.3.1.0/lib/ruby/gems/shared/gems/rjack-slf4j-1.7.25.0-java
├── History.rdoc
├── Manifest.txt
├── README.rdoc
├── Rakefile
├── assembly.xml
├── lib
│   ├── rjack-slf4j
│   │   ├── base.rb
│   │   ├── jcl-over-slf4j-1.7.25.jar
│   │   ├── jcl-over-slf4j.rb
│   │   ├── jcl.rb
│   │   ├── jdk14.rb
│   │   ├── jul-to-slf4j-1.7.25.jar
│   │   ├── jul-to-slf4j.rb
│   │   ├── jul.rb
│   │   ├── log4j-over-slf4j-1.7.25.jar
│   │   ├── log4j-over-slf4j.rb
│   │   ├── log4j12.rb
│   │   ├── mdc.rb
│   │   ├── nop.rb
│   │   ├── simple.rb
│   │   ├── slf4j-api-1.7.25.jar
│   │   ├── slf4j-jcl-1.7.25.jar
│   │   ├── slf4j-jdk14-1.7.25.jar
│   │   ├── slf4j-log4j12-1.7.25.jar
│   │   ├── slf4j-nop-1.7.25.jar
│   │   └── slf4j-simple-1.7.25.jar
│   └── rjack-slf4j.rb
├── pom.xml
└── test
    ├── example_jul_to_slf4j.rb
    └── test_slf4j.rb

3 directories, 29 files

So it's clear to me that without having to set up Maven or Gradle, and without even using jbundler, bundler was able to fetch the exact version of the JAR file needed because this gem wrapped the JAR (and its JAR dependencies apparently).

As for the concern of conflicting JAR files being used, as far as I know within the Java ecosystem, shading is used to help with this. Perhaps JRuby's build process could be changed to shade each of its dependencies, guaranteeing that there would be no conflicts with JAR dependencies JRuby users choose to use. That probably deserves a separate discussion though.

@mkristian
Copy link
Owner

I need to add my input to here:

cc/ @headius @deivid-rodriguez

@deivid-rodriguez
Copy link

As far as I recall, my one concern was that warbler was actually using this project, and I wanted to get warbler up to date and fix some issues related to bundler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants