hello,

I have two thoughts about this. first one is more curiosity how this was solved:

http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Transitive_Dependencies
defines the "nearest definition". so in case the complete dependency
tree has two version of the same jar it chooses one. how is the
behavior mapped to rubygems since such a version resolution does not
exist there?

second thought is:
my world of using ruby is basically rails with jruby and when I want
to deploy a rails application I would like to share as many
libraries/jar with all applications and do not repeat the same jars
for each application in WEB-INF/lib. typical example are the jdbc
drivers, the moment I use gems there is no way to share them anymore.
in data_objects (from datamapper) we do not require the jdbc-gem when
the respective jdbc driver is already in the classloader which allows
this kind of sharing the jdbc jars via the application server/servlet
engine.

with datamapper we also experienced a classloader issue when the it
runs inside a webcontainer: when you get the jar as gem (via require
the respective gem) you can not use
Thread.currentThread().getContextClassloader() to load the jdbc driver
but need to use getClass().getClassloader() to load it. so here your
code behaves differently whether it comes from a jar or from a gem -
hmm. maybe that is more a jruby classloader issue then a gem wrapper
of jar issue.

with regards
Kristian


On Fri, Jan 8, 2010 at 6:22 AM, Charles Oliver Nutter
<[email protected]> wrote:
> If this doesn't make you weep tears of joy, then you have no heart:
>
> http://gist.github.com/271764
>
> Thanks to Tamas Cservenak from Sonatype, we will soon have a special
> gem server that presents all the world's Java libraries as installable
> Ruby Gems!
>
> The format of the gem name is basically using the maven group and
> artifact IDs plus the version number. So for this version of Rhino,
> the group ID is 'rhino' and the artifact ID is also 'rhino', so the
> gem name becomes "rhino.rhino-1.5.4.1-java" (and the -java part just
> indicates this is a gem for jruby).
>
> The resulting gem that installs is basically just a wrapper for the
> jar file. Here's the structure of the rhino gem:
>
> ~/projects/jruby/lib/ruby/gems/1.8/gems ➔ ls -1 -R rhino.rhino-1.5.4.1-java/
> lib
>
> rhino.rhino-1.5.4.1-java//lib:
> rhino-1.5R4.1.jar
> rhino.rhino.rb
>
> It's really barebones. The rhino.rhino.rb file is generated as well,
> and basically just loads the jar for you:
>
> ~/projects/jruby/lib/ruby/gems/1.8/gems ➔ cat
> rhino.rhino-1.5.4.1-java/lib/rhino.rhino.rb
> module Rhino
>  VERSION = '1.5.4.1'
>  MAVEN_VERSION = '1.5R4.1'
> end
> begin
>  require 'java'
>  require File.dirname(__FILE__) + '/rhino-1.5R4.1.jar'
> rescue LoadError
>  puts 'JAR-based gems require JRuby to load. Please visit www.jruby.org.'
>  raise
> end
>
> So I have a few questions and thoughts about how to use this newfound power:
>
> * I would like to add the Maven/Gem proxy server to the default list
> of gem sources for JRuby 1.5
> * You will soon be able to specify these libraries as dependencies in
> regular gems, since RubyGems will just use the combination of
> gemcutter + sonatype to resolve everything.
> * Does the structure of the rhino.rhino.rb file look reasonable?
> * Should we also provide some utility methods on the Rhino module for
> just retrieving the jar file path?
> * Should we require the user to require the jar? I ask because it may
> make bundling jar-based gems into an app if we can see what jar files
> are physically being loaded.
>
> I'd love to hear any other thoughts you have. I'm really excited about this :)
>
> - Charlie
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>



-- 
Kristian Meier + Saumya Sharma + Sanuka Meier
Vadakkethu House,
Edayanmula West PO - 689532,
Pathanamthitta District, Kerala, INDIA

tel: +91 468 2319577

protect your privacy while searching the net: www.ixquick.com

             _=_
           q(-_-)p
            '_) (_`
            /__/  \
         _(<_   / )_
      (__\_\_|_/__)

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to