jar dependencies like old maven-gems #1451
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
this PR is meant to base for further discussion.
previously maven-gems failed mainly version resolution with maven (on version conflict the dependency tree is used to determine the right version) works totally different then rubygems (version ranges).
this patch has two parts one which loads jars and tracks versions. in case of conflicting versions ONLY the first jar is loaded and the second one just gives a warning. kind of the same you have with rubygems where it fails when a second version of a gems gets activated.
the second part is a Gem.post_install hook which uses the info from the installed Gem::Sepcification of the installed gem and looks for jar dependencies declared in the requirements section of the spec. these declared jars and its depencenies will be install using ruby-maven (which can uses the gemspec as a POM !!). it also creates a file {gemspec.name}_jars.rb file which uses the jar_dependencies to track and load the vendored jars.
to main reason to vendor the jars is that regular bundler will just work.
in case there are version conflicts jbundler can help to resolve them or do it manually. it is a matter of which version gets required first, any project should be able to ensure this.
as an example I added the jar dependencies in jruby-openssl gem.