Skip to content

Try to fix Gem.paths #564

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Try to fix Gem.paths #564

wants to merge 1 commit into from

Conversation

tillsc
Copy link
Contributor

@tillsc tillsc commented Jul 15, 2025

See #539 and #537.

This fix is based on comments in the respective tickets. Since the entire file appears to be a hack or monkey patch, I’m not sure whether this is the “correct” solution. However, it works for us with JRuby 9.4, the current master of Warbler, and Bundler 2.6.3, running on Tomcat 9 under macOS and Windows.

@tillsc
Copy link
Contributor Author

tillsc commented Jul 15, 2025

Ping @jlahtinen

@@ -16,4 +16,5 @@ module Bundler
end
end

Gem.paths = ENV
Copy link
Member

@kares kares Jul 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while this might work, not sure this is the proper place (or actually the proper fix).

Gem.paths should have been properly adjusted, otherwise we're kind of in a mess anyway... 🤷

see lib/warbler/templates/jar.erb

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're absolutely right.

We’ve looked into this quite extensively, and honestly, we couldn’t figure out why this issue occurs in some projects but not in others — even when the dependencies and environment are nearly identical.

It would definitely be better to understand and fix the root cause instead of working around it. Unfortunately, we haven’t been able to pinpoint it. Given that monkey patches are already present in the relevant issue comments — and much of this file is already composed of other monkey patches (example here) — we’ve put together this PR to help unblock affected users.

That said, a proper fix to ensure Gem.paths is set up correctly would definitely be preferable. We'd be happy to adjust or close this PR if someone can point us in the right direction.

@jlahtinen
Copy link

jlahtinen commented Jul 28, 2025

I think Gem.paths = ENV is needed when tomcat is started by user that has rvm enabled. But it seems that rvm maybe sets some environment variables that makes rubygems or bundler confused, not sure at all.

But I agree with @kares that this "fix" can be a wrong way to fix the "issue".

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

Successfully merging this pull request may close these issues.

3 participants