Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: JRuby 1.6
    • Component/s: Extensions
    • Labels:
      None
    • Number of attachments :
      0

      Description

      A few items I think need to be improved in the new Maven RubyGems support.

      • The maven_gemify.rb file is not the most canonical Ruby code. It could use some cleanup.
      • I would feel comfortable if we had some measure of control over the gemify plugin itself. That could mean simply getting commit access, moving it to the JRuby account on github, or something similar. We depend on a lot of third-party libraries, of course, but if there's a bug in gemify we need a free hand to fix it.

        Activity

        Hide
        Hiro Asari added a comment -

        It needs to be less verbose (but provide debugging information on demand).

        $ jruby -S irb
        irb(main):001:0> require 'rubygems'
        Installing from Maven using install at /Users/asari/Development/src/apache-maven-3.0/bin
        => true
        irb(main):002:0> 
        
        Show
        Hiro Asari added a comment - It needs to be less verbose (but provide debugging information on demand). $ jruby -S irb irb(main):001:0> require 'rubygems' Installing from Maven using install at /Users/asari/Development/src/apache-maven-3.0/bin => true irb(main):002:0>
        Hide
        Hiro Asari added a comment -

        It needs to provide a better error message if $M2_HOME is invalid.

        $ jruby -S gem install org.clojure.clojure --no-ri --no-rdoc
        /usr/local/jruby/lib/ruby/site_ruby/1.8/rubygems.rb:883:in `source_index': uninitialized constant Gem::SourceIndex (NameError)
        	from /usr/local/jruby/lib/ruby/site_ruby/1.8/rubygems.rb:213:in `activate'
        	from /usr/local/jruby/lib/ruby/site_ruby/1.8/rubygems.rb:1082:in `gem'
        	from /usr/local/jruby/lib/ruby/site_ruby/1.8/rubygems/maven_gemify.rb:78:in `init'
        	from /usr/local/jruby/lib/ruby/site_ruby/1.8/rubygems/maven_gemify.rb:201
        	from /usr/local/jruby/lib/ruby/site_ruby/1.8/rubygems/maven_gemify.rb:10:in `require'
        	from /usr/local/jruby/lib/ruby/site_ruby/1.8/rubygems/specification.rb:10
        	from /usr/local/jruby/lib/ruby/site_ruby/1.8/rubygems/specification.rb:8:in `require'
        	from /usr/local/jruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:8
        	from /usr/local/jruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:1105:in `require'
        	from /usr/local/jruby/lib/ruby/site_ruby/1.8/rubygems.rb:1105
        	from /usr/local/jruby/lib/ruby/site_ruby/1.8/rubygems.rb:8:in `require'
        	from /usr/local/jruby/bin/gem:8
        
        Show
        Hiro Asari added a comment - It needs to provide a better error message if $M2_HOME is invalid. $ jruby -S gem install org.clojure.clojure --no-ri --no-rdoc /usr/local/jruby/lib/ruby/site_ruby/1.8/rubygems.rb:883:in `source_index': uninitialized constant Gem::SourceIndex (NameError) from /usr/local/jruby/lib/ruby/site_ruby/1.8/rubygems.rb:213:in `activate' from /usr/local/jruby/lib/ruby/site_ruby/1.8/rubygems.rb:1082:in `gem' from /usr/local/jruby/lib/ruby/site_ruby/1.8/rubygems/maven_gemify.rb:78:in `init' from /usr/local/jruby/lib/ruby/site_ruby/1.8/rubygems/maven_gemify.rb:201 from /usr/local/jruby/lib/ruby/site_ruby/1.8/rubygems/maven_gemify.rb:10:in `require' from /usr/local/jruby/lib/ruby/site_ruby/1.8/rubygems/specification.rb:10 from /usr/local/jruby/lib/ruby/site_ruby/1.8/rubygems/specification.rb:8:in `require' from /usr/local/jruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:8 from /usr/local/jruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:1105:in `require' from /usr/local/jruby/lib/ruby/site_ruby/1.8/rubygems.rb:1105 from /usr/local/jruby/lib/ruby/site_ruby/1.8/rubygems.rb:8:in `require' from /usr/local/jruby/bin/gem:8
        Hide
        Charles Oliver Nutter added a comment -

        I fixed the excessive logging of "Installing from Maven" so that it only fires during init of maven_gemify, which fires only once when maven stuff is needed during install.

        Confirmed on the bad M2_HOME result; definitely not helpful

        Show
        Charles Oliver Nutter added a comment - I fixed the excessive logging of "Installing from Maven" so that it only fires during init of maven_gemify, which fires only once when maven stuff is needed during install. Confirmed on the bad M2_HOME result; definitely not helpful
        Hide
        kristian meier added a comment -

        does it make sense to leave out M2_HOME since it is really enough to have mvn (version 3) on the executable path ? to run maven you do not need to set M2_HOME.

        Show
        kristian meier added a comment - does it make sense to leave out M2_HOME since it is really enough to have mvn (version 3) on the executable path ? to run maven you do not need to set M2_HOME.
        Hide
        kristian meier added a comment -

        please pull the fix for detecting "wrong M2_HOME" and some little cleanups from https://github.com/mkristian/jruby

        Show
        kristian meier added a comment - please pull the fix for detecting "wrong M2_HOME" and some little cleanups from https://github.com/mkristian/jruby
        Hide
        kristian meier added a comment -

        since the gemify code is also used by the nexus-gem-plugin I think we leave the code location as is. I am happy to give commit permissions to someone (or more) to the jruby-maven-plugins repo. then we need to add this person to allow releases via oss.sonatype.org

        FYI torquebox has also access rights for the git-repo as well for oss.sonatype.org releases. this altogether should give enough "certainty".

        Show
        kristian meier added a comment - since the gemify code is also used by the nexus-gem-plugin I think we leave the code location as is. I am happy to give commit permissions to someone (or more) to the jruby-maven-plugins repo. then we need to add this person to allow releases via oss.sonatype.org FYI torquebox has also access rights for the git-repo as well for oss.sonatype.org releases. this altogether should give enough "certainty".
        Hide
        Charles Oliver Nutter added a comment -

        Re: no M2_HOME, just use executable

        I agree...if it's possible to determine the location just from PATH, we should do it. But if M2_HOME is a standard env var for maven, and the user has set it, that should take priority.

        In order of priority:

        1. M2_HOME if set
        2. Maven from path if found (and I assume there's still work needed to support Maven 2?)
        3. raise, request ruby-maven gem be installed

        If ruby-maven is installed, should that fit higher into priority?

        Re: gemify code location/ownership

        I'm comfortable with that. Getting commit rights for at least one of us would be helpful, in case we need to make a fix at a time when you are unable to add us. I suppose I'd nominate me, since I've poked around maven code and your plugins more than others on JRuby team. Ok?

        Show
        Charles Oliver Nutter added a comment - Re: no M2_HOME, just use executable I agree...if it's possible to determine the location just from PATH, we should do it. But if M2_HOME is a standard env var for maven, and the user has set it, that should take priority. In order of priority: M2_HOME if set Maven from path if found (and I assume there's still work needed to support Maven 2?) raise, request ruby-maven gem be installed If ruby-maven is installed, should that fit higher into priority? Re: gemify code location/ownership I'm comfortable with that. Getting commit rights for at least one of us would be helpful, in case we need to make a fix at a time when you are unable to add us. I suppose I'd nominate me, since I've poked around maven code and your plugins more than others on JRuby team. Ok?
        Hide
        Charles Oliver Nutter added a comment -

        Your changes (improving handling of wrong M2_HOME and other cleanup) have been pushed to master.

        commit c5a40fbeec14e5589446861012d117d6198376a8
        Author: mkristian <m.kristian@web.de>
        Date: Thu Nov 4 18:27:57 2010 +0530

        cleaned up a little and detect wrong M2_HOME

        Signed-off-by: Charles Oliver Nutter <headius@headius.com>

        Show
        Charles Oliver Nutter added a comment - Your changes (improving handling of wrong M2_HOME and other cleanup) have been pushed to master. commit c5a40fbeec14e5589446861012d117d6198376a8 Author: mkristian <m.kristian@web.de> Date: Thu Nov 4 18:27:57 2010 +0530 cleaned up a little and detect wrong M2_HOME Signed-off-by: Charles Oliver Nutter <headius@headius.com>
        Hide
        kristian meier added a comment -

        @headius you are not on https://github.com/mkristian/jruby-maven-plugin now. concerning oss.sonatype.org I would need you to sign-up on https://issues.sonatype.org and let me know your username so I can ask oss.sonatype.org to give you permission to release new versions (see also https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide).

        Show
        kristian meier added a comment - @headius you are not on https://github.com/mkristian/jruby-maven-plugin now. concerning oss.sonatype.org I would need you to sign-up on https://issues.sonatype.org and let me know your username so I can ask oss.sonatype.org to give you permission to release new versions (see also https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide ).
        Hide
        kristian meier added a comment -

        hoops: @headius you ARE on github now !!!!

        Show
        kristian meier added a comment - hoops: @headius you ARE on github now !!!!
        Hide
        Charles Oliver Nutter added a comment -

        I have created an account on issues.sonatype as username "headius". Thank you for giving me access!

        Show
        Charles Oliver Nutter added a comment - I have created an account on issues.sonatype as username "headius". Thank you for giving me access!
        Hide
        Charles Oliver Nutter added a comment -

        Kristian: Where do we stand on supporting maven 2? Ideally this stuff would work for anyone that has a M2 install right now. I know you said it might be close, but I don't think you ever said it was working, correct?

        Show
        Charles Oliver Nutter added a comment - Kristian: Where do we stand on supporting maven 2? Ideally this stuff would work for anyone that has a M2 install right now. I know you said it might be close, but I don't think you ever said it was working, correct?
        Hide
        kristian meier added a comment -

        Headius: maven2 support - hmm. the gap between maven2 and maven3 became bigger between maven-3.0-beta-2 and maven-3.0-beta-3 since they changed the api which is used by geminfy. in meanwhile I started to add ruby support for polyglot-maven-jruby as well for mvnsh and both are maven3 based. so in the end I removed all the maven2 api until now. though the functionality is there in maven2 but supporting two APIs for gemify and two APIs for embedding maven sounds a bit much. in the end distance to use it is just about 2MB download of ruby-maven which works nicely side by side with any maven installation (version 1 or 2 or 3). sorry if I made a promise which I can not keep - at least not right now.

        Show
        kristian meier added a comment - Headius: maven2 support - hmm. the gap between maven2 and maven3 became bigger between maven-3.0-beta-2 and maven-3.0-beta-3 since they changed the api which is used by geminfy. in meanwhile I started to add ruby support for polyglot-maven-jruby as well for mvnsh and both are maven3 based. so in the end I removed all the maven2 api until now. though the functionality is there in maven2 but supporting two APIs for gemify and two APIs for embedding maven sounds a bit much. in the end distance to use it is just about 2MB download of ruby-maven which works nicely side by side with any maven installation (version 1 or 2 or 3). sorry if I made a promise which I can not keep - at least not right now.
        Hide
        kristian meier added a comment -

        referring to following issue

        http://maven-users.828.n2.nabble.com/problems-with-javax-transaction-jta-on-maven-central-td5761597.html

        I found that there some artifacts have no jar on maven central due to licensing issues. like http://repo2.maven.org/maven2/javax/transaction/jta/1.0.1B/ which has only the pom which carries the download url. an other example are the orcale jdbc drivers.

        these cases should produce some descriptive error messages

        Show
        kristian meier added a comment - referring to following issue http://maven-users.828.n2.nabble.com/problems-with-javax-transaction-jta-on-maven-central-td5761597.html I found that there some artifacts have no jar on maven central due to licensing issues. like http://repo2.maven.org/maven2/javax/transaction/jta/1.0.1B/ which has only the pom which carries the download url. an other example are the orcale jdbc drivers. these cases should produce some descriptive error messages
        Hide
        Charles Oliver Nutter added a comment -

        Just checking on on this one. We have a few items outstanding I'll list below.

        • Maven 2 support: ok...I guess this one isn't really possible, since the APIs have diverged so much. We should detect attempts to run against Maven 2 and produce a useful message recommending the ruby-maven gem (or recommending the user update Maven.
        • Gem names should use :, since it turns out that . is a valid character in gem names (and the Cool.io package uses it).
        • Bad poms or artifacts like the javax.transaction.jta artifact mentioned should produce reasonable errors; some of them currently just belch out a giant Java error trace.
        • ruby-maven needs a full release, so people can install it without -pre
        • Nick was looking into maintaining a fork of RubyGems with JRuby-specific branches where we could store these changes. That should probably happen before 1.6.
        • We should investigate what happens when someone does a "gem update --system", which will likely wipe out the Maven changes we've added.

        We'll have an RC cycle for JRuby 1.6 during which we can test out and fix issues as they arise.

        Show
        Charles Oliver Nutter added a comment - Just checking on on this one. We have a few items outstanding I'll list below. Maven 2 support: ok...I guess this one isn't really possible, since the APIs have diverged so much. We should detect attempts to run against Maven 2 and produce a useful message recommending the ruby-maven gem (or recommending the user update Maven. Gem names should use :, since it turns out that . is a valid character in gem names (and the Cool.io package uses it). Bad poms or artifacts like the javax.transaction.jta artifact mentioned should produce reasonable errors; some of them currently just belch out a giant Java error trace. ruby-maven needs a full release, so people can install it without -pre Nick was looking into maintaining a fork of RubyGems with JRuby-specific branches where we could store these changes. That should probably happen before 1.6. We should investigate what happens when someone does a "gem update --system", which will likely wipe out the Maven changes we've added. We'll have an RC cycle for JRuby 1.6 during which we can test out and fix issues as they arise.
        Hide
        Thomas E Enebo added a comment -

        buildr also uses ':' as well so the precedent is well established.

        Show
        Thomas E Enebo added a comment - buildr also uses ':' as well so the precedent is well established.
        Hide
        kristian meier added a comment -

        ':' is not allowed in artifactId by maven-3. but I can build a gem with such character in the name. actually the rubygems side breaks the moment the first gem with such a name gets pushed to rubygems. and people will see quite a few of such names through this maven-gemify feature. in the ned we would need something which is not allowed by rubygems but which we can force to use anyways for our gems. if that is not possible then maybe something better then just ':': on top of the ':' separator add a prefix which people do NOT LIKE to use themselves: 'maven:' )

        Show
        kristian meier added a comment - ':' is not allowed in artifactId by maven-3. but I can build a gem with such character in the name. actually the rubygems side breaks the moment the first gem with such a name gets pushed to rubygems. and people will see quite a few of such names through this maven-gemify feature. in the ned we would need something which is not allowed by rubygems but which we can force to use anyways for our gems. if that is not possible then maybe something better then just ':': on top of the ':' separator add a prefix which people do NOT LIKE to use themselves: 'maven:' )
        Hide
        Charles Oliver Nutter added a comment -

        We need to keep in mind a point of paramount importance: the names we choose must work in gemspecs. If I push a gem that depends on a name that breaks RubyGems, many people would be very unhappy with me...

        The colon version appears to fail in RubyGems when attempting to install dependencies. Could just be a missing piece of logic? Below, both forms build ok but only the all-dots form manages to resolve and install the dependency:

        ~/projects/cloby &#10132; gem build cloby.gemspec 
        WARNING:  description and summary are identical
          Successfully built RubyGem
          Name: cloby
          Version: 0.0.2
          File: cloby-0.0.2-java.gem
        
        ~/projects/cloby &#10132; gem uninstall org.clojure.clojure
        Successfully uninstalled org.clojure.clojure-1.2.0-java
        
        ~/projects/cloby &#10132; gem install cloby-0.0.2-java.gem 
        ERROR:  Error installing cloby-0.0.2-java.gem:
        	cloby requires org.clojure:clojure (>= 0, runtime)
        
        ~/projects/cloby &#10132; vi cloby.gemspec 
        
        ~/projects/cloby &#10132; gem build cloby.gemspec 
        WARNING:  description and summary are identical
          Successfully built RubyGem
          Name: cloby
          Version: 0.0.2
          File: cloby-0.0.2-java.gem
        
        ~/projects/cloby &#10132; gem install cloby-0.0.2-java.gem 
        Successfully installed org.clojure.clojure-1.2.0-java
        Successfully installed cloby-0.0.2-java
        2 gems installed
        

        I'm not opposed to adding another item to the name, like prefixing it with "mvn." and unconditionally treating that as a maven gem. That is similar to the namespacing people do by inserting their username in front of an existing gem to make it their own release of that gem (a la mojombo-jekyll and similar). I just worry about the names getting too long. Perhaps four characters is not too much to ask?

        Show
        Charles Oliver Nutter added a comment - We need to keep in mind a point of paramount importance: the names we choose must work in gemspecs. If I push a gem that depends on a name that breaks RubyGems, many people would be very unhappy with me... The colon version appears to fail in RubyGems when attempting to install dependencies. Could just be a missing piece of logic? Below, both forms build ok but only the all-dots form manages to resolve and install the dependency: ~/projects/cloby &#10132; gem build cloby.gemspec WARNING: description and summary are identical Successfully built RubyGem Name: cloby Version: 0.0.2 File: cloby-0.0.2-java.gem ~/projects/cloby &#10132; gem uninstall org.clojure.clojure Successfully uninstalled org.clojure.clojure-1.2.0-java ~/projects/cloby &#10132; gem install cloby-0.0.2-java.gem ERROR: Error installing cloby-0.0.2-java.gem: cloby requires org.clojure:clojure (>= 0, runtime) ~/projects/cloby &#10132; vi cloby.gemspec ~/projects/cloby &#10132; gem build cloby.gemspec WARNING: description and summary are identical Successfully built RubyGem Name: cloby Version: 0.0.2 File: cloby-0.0.2-java.gem ~/projects/cloby &#10132; gem install cloby-0.0.2-java.gem Successfully installed org.clojure.clojure-1.2.0-java Successfully installed cloby-0.0.2-java 2 gems installed I'm not opposed to adding another item to the name, like prefixing it with "mvn." and unconditionally treating that as a maven gem. That is similar to the namespacing people do by inserting their username in front of an existing gem to make it their own release of that gem (a la mojombo-jekyll and similar). I just worry about the names getting too long. Perhaps four characters is not too much to ask?
        Hide
        kristian meier added a comment -

        the problem with the ':' is that the gemify-maven-plugin needs to use the ':' as well when setting up the gemspec for the gem - right now it use the '.'. so the above issue can be fixed. personally I would use the 'mvn:' on top of it to be on the safe side in the long run.

        Show
        kristian meier added a comment - the problem with the ':' is that the gemify-maven-plugin needs to use the ':' as well when setting up the gemspec for the gem - right now it use the '.'. so the above issue can be fixed. personally I would use the 'mvn:' on top of it to be on the safe side in the long run.
        Hide
        Douglas Campos added a comment -

        +1 on 'mvn:' namespacing, for the sake of clarity and code simplicity

        Show
        Douglas Campos added a comment - +1 on 'mvn:' namespacing, for the sake of clarity and code simplicity
        Hide
        kristian meier added a comment -

        'mvn:' would solve this problem as well: http://jira.codehaus.org/browse/JRUBY-5344

        Show
        kristian meier added a comment - 'mvn:' would solve this problem as well: http://jira.codehaus.org/browse/JRUBY-5344
        Hide
        Nick Sieger added a comment -

        As of 2fc90bd0 I think most of these issues are fixed. Open a new bug for new features/suggestions.

        Show
        Nick Sieger added a comment - As of 2fc90bd0 I think most of these issues are fixed. Open a new bug for new features/suggestions.

          People

          • Assignee:
            Unassigned
            Reporter:
            Charles Oliver Nutter
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: