-
-
Notifications
You must be signed in to change notification settings - Fork 925
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
require_relative fails for relative paths within jars on Windows #3197
Comments
Quick workaround for our particular situation is to avoid using paths inside jars, but put the jar on the classpath and then use "uri:classloader:" file paths. e.g., we had this, which fails:
This was replaced by the following, which works fine:
Or I guess you can just avoid putting gems in jars, but I rather like the ability to do this, because it makes it easier to keep everything together. |
packing gems inside a jar is used quite a lot. and it should even work |
This just bit me, really hard. I'm trying to load active_support inside a gems.jar file, and I'm getting a similar dump. It's like org.jruby.Rubyfile.realpath messes up the path separators, and suddenly it can't read the jar file anymore. 😞 Sadly it just brought my release process to a hard halt for now. |
this could be already fixed with #3401 which has a fix on jruby-1_7 branch - did not merge to master yet. |
I did the test where I put actionpack (and a lot of other gems into a jar file). I picked actionpack since the version.rb file uses a relative_require. With a very recent fix from @mkristian (a5dd1b7) in addition to #3401 fixed I think all issues mentioned here. |
I think this needs to be reopened. I have a hello world program that I pack into a jar with warbler.
Running it throws an exception:
File structure of jar:
Using require works fine. |
@griest024 but I do not see a and I do not know how warbler executes main.rb as it seems to twice inside the jar. if warbler executes if you |
@mkristian sorry I refactored some stuff to make it clearer. Here are the correct contents of the jar
Also
|
@griest024 the thing here is that main.rb can not see hello.rb even if you would unpack the jar and add |
We use gems in a jar to simplify distribution of the gems used for test runs.
When requiring rspec, rspec internally uses
require_relative
, which then fails. I notice there is a weird mix of the two different slash directions, which probably explains why I'm not seeing the same problem on OSX:The text was updated successfully, but these errors were encountered: