mkristian / ruby-maven

repo moved to
https://github.com/takari/ruby-maven
MIT License
28 stars 7 forks source link

Gemfile test scope support #3

Closed ddossot closed 10 years ago

ddossot commented 10 years ago

I have a project with Mavenfile and a Gemfile.

The Gemfile contains:

group :test do
   gem 'rspec',        '2.13.0'
end

But the generated pom.xml contains:

<dependency>
  <groupId>rubygems</groupId>
  <artifactId>rspec</artifactId>
  <version>2.13.0</version>
  <type>gem</type>
</dependency>

As you can see, <scope>test</scope> is missing on the rspec gem dependency.

mkristian commented 10 years ago

just pushed maven-tools-0.34.5.gem which fixes this problem. just gem update maven-tools and then ruby-maven should pick the new gem.

ddossot commented 10 years ago

Thanks a lot for the quick response.

Unfortunately, I see no difference in behaviour: the test-scoped gems still end up in the compile scope (i.e. no scope defined in the generated pom.xml).

Here are the version of my gems:

maven-tools (0.34.5)
ruby-maven (3.1.1.0.2)
ruby-maven-libs (3.1.1)

Any further information I could provide you or test I could run to help diagnose the issue?

mkristian commented 10 years ago

I guess I was wrong about that a new gem will resolve the issue. I need to deploy a new version of ruby-maven - try to get it out tomorrow. sorry - I did not test it directly with ruby-maven - I just tested the new gem :(

ddossot commented 10 years ago

No worries, your support so valuable, thanks again for it! I'll test it again tomorrow.

mkristian commented 10 years ago

actually I wanted to mention that the :group => :test notation works, it was only the group block which did not work.

ddossot commented 10 years ago

I'm happy to confirm the :group => :test syntax works :)

mkristian commented 10 years ago

just pushed ruby-maven-3.1.1.0.3 gem - could please see if that really solves your original problem ?

ddossot commented 10 years ago

Thank you!

So I first did:

$ gem update ruby-maven
Updating installed gems
Updating ruby-maven
Fetching: equalizer-0.0.9.gem (100%)
Successfully installed equalizer-0.0.9
Fetching: coercible-1.0.0.gem (100%)
Successfully installed coercible-1.0.0
Fetching: ice_nine-0.11.0.gem (100%)
Successfully installed ice_nine-0.11.0
Fetching: axiom-types-0.1.1.gem (100%)
Successfully installed axiom-types-0.1.1
Fetching: virtus-1.0.2.gem (100%)
Successfully installed virtus-1.0.2
Fetching: maven-tools-1.0.0.rc4.gem (100%)
Successfully installed maven-tools-1.0.0.rc4
Fetching: ruby-maven-3.1.1.0.3.gem (100%)
Successfully installed ruby-maven-3.1.1.0.3
Parsing documentation for equalizer-0.0.9
Installing ri documentation for equalizer-0.0.9
Installing darkfish documentation for equalizer-0.0.9
Parsing documentation for coercible-1.0.0
Installing ri documentation for coercible-1.0.0
Installing darkfish documentation for coercible-1.0.0
Parsing documentation for ice_nine-0.11.0
Installing ri documentation for ice_nine-0.11.0
Installing darkfish documentation for ice_nine-0.11.0
Parsing documentation for axiom-types-0.1.1
Installing ri documentation for axiom-types-0.1.1
Installing darkfish documentation for axiom-types-0.1.1
Parsing documentation for virtus-1.0.2
Installing ri documentation for virtus-1.0.2
Installing darkfish documentation for virtus-1.0.2
Parsing documentation for maven-tools-1.0.0.rc4
Installing ri documentation for maven-tools-1.0.0.rc4
Installing darkfish documentation for maven-tools-1.0.0.rc4
Parsing documentation for ruby-maven-3.1.1.0.3
Installing ri documentation for ruby-maven-3.1.1.0.3
Installing darkfish documentation for ruby-maven-3.1.1.0.3
Gems updated: equalizer coercible ice_nine axiom-types virtus maven-tools ruby-maven

then I tried:

$ rmvn clean package
[INFO] Scanning for projects...
/home/ddossot/dev/projects/vertx-samples/vertx-ruby-sample/.tesla.Mavenfile
---------------------------------------------------
constituent[0]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-libs-3.1.1/conf/logging/
constituent[1]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-libs-3.1.1/lib/commons-cli-1.2.jar
constituent[2]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-libs-3.1.1/lib/maven-settings-3.1.1.jar
constituent[3]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-libs-3.1.1/lib/jsr250-api-1.0.jar
constituent[4]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-libs-3.1.1/lib/maven-embedder-3.1.1.jar
constituent[5]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-libs-3.1.1/lib/maven-repository-metadata-3.1.1.jar
constituent[6]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-libs-3.1.1/lib/maven-settings-builder-3.1.1.jar
constituent[7]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-libs-3.1.1/lib/slf4j-simple-1.7.5.jar
constituent[8]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-libs-3.1.1/lib/org.eclipse.sisu.plexus-0.0.0.M5.jar
constituent[9]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-libs-3.1.1/lib/cdi-api-1.0.jar
constituent[10]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-libs-3.1.1/lib/maven-model-3.1.1.jar
constituent[11]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-libs-3.1.1/lib/org.eclipse.sisu.inject-0.0.0.M5.jar
constituent[12]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-libs-3.1.1/lib/plexus-interpolation-1.19.jar
constituent[13]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-libs-3.1.1/lib/javax.inject-1.jar
constituent[14]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-libs-3.1.1/lib/wagon-provider-api-2.4.jar
constituent[15]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-libs-3.1.1/lib/plexus-sec-dispatcher-1.3.jar
constituent[16]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-libs-3.1.1/lib/aether-util-0.9.0.M2.jar
constituent[17]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-libs-3.1.1/lib/plexus-component-annotations-1.5.5.jar
constituent[18]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-libs-3.1.1/lib/maven-compat-3.1.1.jar
constituent[19]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-libs-3.1.1/lib/maven-core-3.1.1.jar
constituent[20]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-libs-3.1.1/lib/maven-artifact-3.1.1.jar
constituent[21]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-libs-3.1.1/lib/guava-11.0.2.jar
constituent[22]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-libs-3.1.1/lib/plexus-cipher-1.7.jar
constituent[23]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-libs-3.1.1/lib/wagon-http-2.4-shaded.jar
constituent[24]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-libs-3.1.1/lib/maven-model-builder-3.1.1.jar
constituent[25]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-libs-3.1.1/lib/maven-plugin-api-3.1.1.jar
constituent[26]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-libs-3.1.1/lib/aether-connector-wagon-0.9.0.M2.jar
constituent[27]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-libs-3.1.1/lib/aether-api-0.9.0.M2.jar
constituent[28]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-libs-3.1.1/lib/slf4j-api-1.7.5.jar
constituent[29]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-libs-3.1.1/lib/aether-spi-0.9.0.M2.jar
constituent[30]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-libs-3.1.1/lib/wagon-file-2.4.jar
constituent[31]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-libs-3.1.1/lib/aether-impl-0.9.0.M2.jar
constituent[32]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-libs-3.1.1/lib/jsr305-1.3.9.jar
constituent[33]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-libs-3.1.1/lib/aopalliance-1.0.jar
constituent[34]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-libs-3.1.1/lib/plexus-utils-3.0.15.jar
constituent[35]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-libs-3.1.1/lib/sisu-guice-3.1.3-no_aop.jar
constituent[36]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-libs-3.1.1/lib/maven-aether-provider-3.1.1.jar
constituent[37]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-3.1.1.0.3/ext/ruby/tesla-polyglot-ruby-0.1.0.jar
constituent[38]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-3.1.1.0.3/lib/tesla-polyglot-cli-0.1.0.jar
constituent[39]: file:/home/ddossot/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/ruby-maven-3.1.1.0.3/lib/tesla-polyglot-common-0.1.0.jar
---------------------------------------------------
Exception in thread "main" java.lang.NoClassDefFoundError: org/jruby/embed/ScriptingContainer
    at org.sonatype.maven.polyglot.ruby.RubyParser.<init>(RubyParser.java:40)
    at org.sonatype.maven.polyglot.ruby.RubyModelReader.read(RubyModelReader.java:64)
    at org.sonatype.maven.polyglot.io.ModelReaderSupport.read(ModelReaderSupport.java:51)
    at org.sonatype.maven.polyglot.TeslaModelProcessor.read(TeslaModelProcessor.java:102)
    at org.sonatype.maven.polyglot.TeslaModelProcessor.read(TeslaModelProcessor.java:86)
    at org.apache.maven.model.building.DefaultModelBuilder.readModel(DefaultModelBuilder.java:453)
    at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:256)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:411)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:380)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:344)
    at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:637)
    at org.apache.maven.DefaultMaven.getProjectsForMavenReactor(DefaultMaven.java:586)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:229)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
    at org.apache.maven.cli.PolyglotMavenCli.main(PolyglotMavenCli.java:64)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: java.lang.ClassNotFoundException: org.jruby.embed.ScriptingContainer
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:259)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:235)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:227)
    ... 25 more

Am I missing something?

mkristian commented 10 years ago

thanx you for the report. I could reproduce it, i.e. there are still some artifacts missing on maven-central without them jruby will not be setup. I need to work on a better error handling here ;)

mkristian commented 10 years ago

ruby-maven-3.1.1.0.4 should now load the missing artifacts on its first run. "should" since I was quite sure ruby-maven-3.1.1.0.3 was working as well ;)

ddossot commented 10 years ago

It works great, thanks a lot!