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

Dependent jars specified in gem via :path option not added to classpath #43

Closed
camertron opened this issue Jul 17, 2014 · 20 comments
Closed

Comments

@camertron
Copy link
Contributor

Hey @mkristian,

I have two projects, rosette-server and rosette-core. The rosette-core library has a Jarfile that includes a single dependency (org.eclipse:jgit). I have added rosette-core to rosette-server's Gemfile and run jbundle. At first, I got a TypeError because something was trying to dup a nil, but I tracked down the cause and submitted a pull request to the jar-dependencies gem. After patching jar-dependencies, I tried running jbundle again. This time there were no errors, but jgit wasn't detected or bundled (i.e. it wasn't downloaded and it isn't in rosette-server's classpath). Any idea why this isn't working?

Here's how the dependency looks in my Gemfile:

gem 'rosette-core', path: '~/workspace/rosette-core'
@camertron
Copy link
Contributor Author

Another question. I'm trying to install jgit via the Jarfile like so:

jar 'org.eclipse:jgit', '3.4.1.201406201815-r'

I'm getting this error which makes no sense to me:

[ERROR] Failed to execute goal on project rosette-server: 
Could not resolve dependencies for project rubygems:rosette-server:gem:1.0.0: 
Could not find artifact org.eclipse:jgit:jar:3.4.1.201406201815-r in 
rubygems-releases (http://rubygems-proxy.torquebox.org/releases) -> [Help 1]

Why is it looking in some torquebox release repo instead of maven central??

@camertron
Copy link
Contributor Author

Ah ok, never mind for the second question, I had the groupId wrong, sorry!

@mkristian
Copy link
Owner

yes, maven is a bit confusing if there are more then one repo defined and
it can not find the artifact :)

@mkristian
Copy link
Owner

I guess a new version of jar-dependencies will do - I push a new gem either today or tomorrow

@camertron
Copy link
Contributor Author

Hey @mkristian, thanks for your response. I'm still seeing the issue I first commented on above, can you advise?

@mkristian
Copy link
Owner

not clear ! the one with the gem and :path options ? or the wrong groupId ?

@camertron
Copy link
Contributor Author

Oh sorry yes, the one with the gem and :path options.

@mkristian
Copy link
Owner

you said with your patch it worked ? so what is going wrong after your patched applied ? let me see if I can reproduce it . .

@mkristian
Copy link
Owner

I see some strange "delete missing errors" on gemspec without jar dependenices using path options.

you can use the fallback

jbundle lock_down

which uses old code from jbundler-0.5.5 on install

at least the error I am seeing I can fix.

@mkristian
Copy link
Owner

mkristian/jar-dependencies@6e80dbf should help in your case.

just pushed jar-dependencies-0.0.6.gem - so if you update this then jbundle install should work for you. please let me know if the problem still prevails on your side !!

@camertron
Copy link
Contributor Author

Hey @mkristian thanks! I don't see the error anymore, but the jar dependencies still aren't carrying over. The original problem here wasn't the bug in jar-dependencies - it was the :path issue I commented on first. I've specified a dependency via :path that contains a Jarfile. Running jbundle doesn't download the jars specified in the dependent gems. Here's my file structure:

rosette-core
--> Jarfile (jar 'org.eclipse.jgit:org.eclipse.jgit', '3.4.1.201406201815-r')

rosette-server
--> Jarfile (blank)
--> Gemfile (gem 'rosette-core', path: '~/workspace/rosette-core')

If I change directory into rosette-server and run jbundle, this is the output I see:

jbundler provided classpath:
----------------
/Users/legrandfromage/.m2/repository/joda-time/joda-time/2.3/joda-time-2.3.jar
/Users/legrandfromage/.m2/repository/com/martiansoftware/nailgun-server/0.9.1/nailgun-server-0.9.1.jar
/Users/legrandfromage/.m2/repository/org/jruby/jruby-core/1.7.13/jruby-core-1.7.13.jar
/Users/legrandfromage/.m2/repository/com/github/jnr/jffi/1.2.7/jffi-1.2.7-native.jar
/Users/legrandfromage/.m2/repository/org/ow2/asm/asm-analysis/4.0/asm-analysis-4.0.jar
/Users/legrandfromage/.m2/repository/com/jcraft/jzlib/1.1.2/jzlib-1.1.2.jar
/Users/legrandfromage/.m2/repository/com/github/jnr/jnr-enxio/0.4/jnr-enxio-0.4.jar
/Users/legrandfromage/.m2/repository/com/headius/options/1.1/options-1.1.jar
/Users/legrandfromage/.m2/repository/com/github/jnr/jnr-netdb/1.1.2/jnr-netdb-1.1.2.jar
/Users/legrandfromage/.m2/repository/org/ow2/asm/asm-commons/4.0/asm-commons-4.0.jar
/Users/legrandfromage/.m2/repository/org/jruby/yecht/1.0/yecht-1.0.jar
/Users/legrandfromage/.m2/repository/org/ow2/asm/asm-util/4.0/asm-util-4.0.jar
/Users/legrandfromage/.m2/repository/com/github/jnr/jnr-ffi/1.0.7/jnr-ffi-1.0.7.jar
/Users/legrandfromage/.m2/repository/com/headius/invokebinder/1.2/invokebinder-1.2.jar
/Users/legrandfromage/.m2/repository/org/ow2/asm/asm-tree/4.0/asm-tree-4.0.jar
/Users/legrandfromage/.m2/repository/org/jruby/joni/joni/2.1.1/joni-2.1.1.jar
/Users/legrandfromage/.m2/repository/org/jruby/jruby-stdlib/1.7.13/jruby-stdlib-1.7.13.jar
/Users/legrandfromage/.m2/repository/com/github/jnr/jnr-posix/3.0.1/jnr-posix-3.0.1.jar
/Users/legrandfromage/.m2/repository/org/jruby/extras/bytelist/1.0.11/bytelist-1.0.11.jar
/Users/legrandfromage/.m2/repository/org/jruby/jcodings/jcodings/1.0.10/jcodings-1.0.10.jar
/Users/legrandfromage/.m2/repository/com/github/jnr/jnr-x86asm/1.0.2/jnr-x86asm-1.0.2.jar
/Users/legrandfromage/.m2/repository/com/github/jnr/jffi/1.2.7/jffi-1.2.7.jar
/Users/legrandfromage/.m2/repository/org/yaml/snakeyaml/1.13/snakeyaml-1.13.jar
/Users/legrandfromage/.m2/repository/com/github/jnr/jnr-constants/0.8.5/jnr-constants-0.8.5.jar
/Users/legrandfromage/.m2/repository/com/github/jnr/jnr-unixsocket/0.3/jnr-unixsocket-0.3.jar
/Users/legrandfromage/.m2/repository/org/ow2/asm/asm/4.0/asm-4.0.jar

jbundler runtime classpath:
---------------------------

jbundler test classpath:
------------------------
    --- empty ---

jbundle complete

Notice that under jbundler runtime classpath there are no jars listed. I expect jgit to be listed here.

@camertron
Copy link
Contributor Author

This still doesn't work even if I add the requirement in the gemspec.

@mkristian
Copy link
Owner

OK - I get closer to what you are doing ;)

well, Jarfile is not transitive in the same manner as Gemfile is not. i.e. if you want to have jar dependencies "associated" with your gem you need to add them to your gemspec:

  s.requirements << 'jar 'org.eclipse.jgit:org.eclipse.jgit', '3.4.1.201406201815-r'

see also https://github.com/mkristian/jar-dependencies/blob/master/example/example.gemspec#L18

that should carry over the dependencies to your rosette-server

@camertron
Copy link
Contributor Author

Ok, that makes sense. Unfortunately I already tried adding the requirement to the gemspec and it still doesn't work :(

@mkristian
Copy link
Owner

yes, I just saw you message popping up when I click the send button ;)

I can confirm the problem - yes, it does not show the dependent jars. I
will come back to you when I found the problem ;)

@camertron
Copy link
Contributor Author

Thank you!

@mkristian
Copy link
Owner

just pushed a new jbundler gem, but make sure you get updates on jar-dependencies and maven-tools gems as well. let me know if you still have problems !

@camertron
Copy link
Contributor Author

Wonderful thank you! I'll give it a try this afternoon :)

@camertron
Copy link
Contributor Author

Thanks @mkristian this works for me, apologies for not commenting on the issue :)

@mkristian
Copy link
Owner

no problem - I guessed/hoped it is working for you ;)

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

2 participants