Comments (6)
To avoid this behavior we're already using:
ENV['JARS_NO_REQUIRE'] = 'true'
ENV['JBUNDLE_SKIP'] = 'true'
ENV['JARS_SKIP'] = 'true'
In many cases at @lookout where we want to avoid this behavior from jbundler. I'm on the fence as to which approach is the right approach here. What you're proposing would put all the work on loading the included bytecode from a jar like slf4j into the RubyRuntime
's classloader wouldn't it?
What happens if there are two RubyRuntime
instances being created/executed inside the same JVM? (which is the case with Storm topologies)
I don't have strong opinion either way, I want to make sure jruby-gradle provides the best, most bug-free, experience on JRuby :)
from jruby-gradle-jar-plugin.
from the jruby point of view: each runtime has its own JRubyClassLoader. each require 'my.jar'
will be loaded by its runtime into its JRubyClassLoader.
within one jvm one jruby=runtime can use 'slf4j-simple' and the other can use the 'slf4j-log4j' bridge and the third one can use 'logback' - they are all nicely separated per runtime. this is the jruby-classloader semantic.
this example does not work when you put all the jars + jruby into ONE classloader.
and with leafy-metrics and its slf4j-simple it means it can create subtle bugs when using something like logback: it depends on the class-loading which slf4j binding is used (maybe there is warning that more then one bindings are present) or its depends on how the uberjar choose from duplicated classes.
another example is if there is an artifact which uses joda-time-1.6.x and things work standalone, but when bundled with jruby it might (again depends on which classes are picked when bundling the uberjar) blow up jruby since it depends on joda-time-2.x (joda-time 2 is mostly backward compatible to 1.6.x)
so want I propose is to bundle jar-dependencies like gems:
JARS_VENDOR=false JARS_HOME=. GEM_HOME=. GEM_PATH=. gem install rake rspec
take "gems" and "specification" directory and all the directories containing a jar and add them to the userjar.
not sure about jbundler but this does not seems to be relavent since build.gradle does not do anything with the Jarfile - as far I understand.
from jruby-gradle-jar-plugin.
ENV['JBUNDLE_SKIP'] = 'true'
is probably not needed unless you bundle jbundler gem as well
`ENV['JARS_SKIP'] = 'true'`` that is not using maven to install jar-dependencies
ENV['JARS_NO_REQUIRE'] = 'true'
is needed when the jars are in the same classloader as jruby itself
from jruby-gradle-jar-plugin.
added some intro for https://github.com/mkristian/jruby-mains which explains 'my vision'
from jruby-gradle-jar-plugin.
about the more then one runtime there is subtle issue when running via the regular org.jruby.Main entry-point where the second runtime just uses the jruby-classloader from the first runtime as parent and inherits all its resources: jruby/jruby#2025
again it is easy to construct examples which just fail with such setup - the question is whether those example have practical implication.
IMO jruby just behave as much the same however you execute it.
from jruby-gradle-jar-plugin.
this is done now :)
from jruby-gradle-jar-plugin.
Related Issues (20)
- Remove any dependency on warbler-bootstrap HOT 1
- embedded gems need directory file .jrubydir HOT 9
- reproducible builds with gem dependencies HOT 3
- if there is not META-INF/init.rb just do not try to require it HOT 3
- consider running the jar without unpacking it HOT 9
- Should the jar plugin disable the java plugin's jar task and archive?
- Changed the default init script name away from init.rb
- TODO list for 0.1.4 HOT 1
- Fat jar configuration should be maintained through the jrubyJar task HOT 2
- jar task should support create a Ruby-based library jar HOT 1
- Jar task should support creating Ruby-based library jars which include gems HOT 1
- jrubyJar shouldn't require the jar task to execute HOT 2
- jrubyJar should throw StopTaskExecuteException if an initScript does not exist HOT 2
- Plugin should have a JRubyFatJar type which can be extended HOT 1
- make a proper sourceSet for src/main/ruby and src/test/ruby HOT 1
- allow the jrubyJar taks to use an alternative "gems" dependencies
- allow the user of JRubyJar task to pick the DuplicatesStrategy
- Following the README yields "there is no initScript configured" from gradle task execution HOT 2
- some copy directives on jrubyJar do not produce .jrubydir files
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jruby-gradle-jar-plugin.