mkristian / jar-dependencies

manage jar dependencies for ruby gems
MIT License
34 stars 19 forks source link

fail to run on jruby 9.0.5.0 #39

Closed jsvd closed 8 years ago

jsvd commented 8 years ago

when executing usual bootstrap tasks in logstash, if I switch to jruby 9k I'm getting:

Error Bundler::InstallError, retrying 3/10
An error occurred while installing logstash-core-event-java (3.0.0.dev), and Bundler cannot continue.
Make sure that `gem install logstash-core-event-java -v '3.0.0.dev'` succeeds before bundling.
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T12:57:37+01:00)
Maven home: /Users/joaoduarte/experiments/startup_speed/logstash/vendor/jruby/lib/ruby/maven-home
Java version: 1.8.0_20, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.11.3", arch: "x86_64", family: "mac"
[DEBUG] Created new class realm maven.api
[DEBUG] Importing foreign packages into class realm maven.api
[DEBUG]   Imported: javax.enterprise.inject.* < plexus.core
[DEBUG]   Imported: javax.enterprise.util.* < plexus.core
[DEBUG]   Imported: javax.inject.* < plexus.core
[DEBUG]   Imported: org.apache.maven.* < plexus.core
[DEBUG]   Imported: org.apache.maven.artifact < plexus.core
[DEBUG]   Imported: org.apache.maven.classrealm < plexus.core
[DEBUG]   Imported: org.apache.maven.cli < plexus.core
[DEBUG]   Imported: org.apache.maven.configuration < plexus.core
[DEBUG]   Imported: org.apache.maven.exception < plexus.core
[DEBUG]   Imported: org.apache.maven.execution < plexus.core
[DEBUG]   Imported: org.apache.maven.execution.scope < plexus.core
[DEBUG]   Imported: org.apache.maven.lifecycle < plexus.core
[DEBUG]   Imported: org.apache.maven.model < plexus.core
[DEBUG]   Imported: org.apache.maven.monitor < plexus.core
[DEBUG]   Imported: org.apache.maven.plugin < plexus.core
[DEBUG]   Imported: org.apache.maven.profiles < plexus.core
[DEBUG]   Imported: org.apache.maven.project < plexus.core
[DEBUG]   Imported: org.apache.maven.reporting < plexus.core
[DEBUG]   Imported: org.apache.maven.repository < plexus.core
[DEBUG]   Imported: org.apache.maven.rtinfo < plexus.core
[DEBUG]   Imported: org.apache.maven.settings < plexus.core
[DEBUG]   Imported: org.apache.maven.toolchain < plexus.core
[DEBUG]   Imported: org.apache.maven.usability < plexus.core
[DEBUG]   Imported: org.apache.maven.wagon.* < plexus.core
[DEBUG]   Imported: org.apache.maven.wagon.authentication < plexus.core
[DEBUG]   Imported: org.apache.maven.wagon.authorization < plexus.core
[DEBUG]   Imported: org.apache.maven.wagon.events < plexus.core
[DEBUG]   Imported: org.apache.maven.wagon.observers < plexus.core
[DEBUG]   Imported: org.apache.maven.wagon.proxy < plexus.core
[DEBUG]   Imported: org.apache.maven.wagon.repository < plexus.core
[DEBUG]   Imported: org.apache.maven.wagon.resource < plexus.core
[DEBUG]   Imported: org.codehaus.classworlds < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.* < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.classworlds < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.component < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.configuration < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.container < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.context < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.lifecycle < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.logging < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.personality < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.util.xml.Xpp3Dom < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.util.xml.pull.XmlPullParser < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.util.xml.pull.XmlPullParserException < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.util.xml.pull.XmlSerializer < plexus.core
[DEBUG]   Imported: org.eclipse.aether.* < plexus.core
[DEBUG]   Imported: org.eclipse.aether.artifact < plexus.core
[DEBUG]   Imported: org.eclipse.aether.collection < plexus.core
[DEBUG]   Imported: org.eclipse.aether.deployment < plexus.core
[DEBUG]   Imported: org.eclipse.aether.graph < plexus.core
[DEBUG]   Imported: org.eclipse.aether.impl < plexus.core
[DEBUG]   Imported: org.eclipse.aether.installation < plexus.core
[DEBUG]   Imported: org.eclipse.aether.internal.impl < plexus.core
[DEBUG]   Imported: org.eclipse.aether.metadata < plexus.core
[DEBUG]   Imported: org.eclipse.aether.repository < plexus.core
[DEBUG]   Imported: org.eclipse.aether.resolution < plexus.core
[DEBUG]   Imported: org.eclipse.aether.spi < plexus.core
[DEBUG]   Imported: org.eclipse.aether.transfer < plexus.core
[DEBUG]   Imported: org.eclipse.aether.version < plexus.core
[DEBUG]   Imported: org.slf4j.* < plexus.core
[DEBUG]   Imported: org.slf4j.spi.* < plexus.core
[DEBUG] Populating class realm maven.api
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from /Users/joaoduarte/experiments/startup_speed/logstash/vendor/jruby/lib/ruby/maven-home/conf/settings.xml
[DEBUG] Reading user settings from /Users/joaoduarte/.m2/settings.xml
[DEBUG] Reading global toolchains from /Users/joaoduarte/experiments/startup_speed/logstash/vendor/jruby/lib/ruby/maven-home/conf/toolchains.xml
[DEBUG] Reading user toolchains from /Users/joaoduarte/.m2/toolchains.xml
[DEBUG] Using local repository at /Users/joaoduarte/.m2/repository
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for /Users/joaoduarte/.m2/repository
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-parseable POM /Users/joaoduarte/experiments/startup_speed/logstash/vendor/bundle/jruby/2.2.0/gems/jar-dependencies-0.3.2/lib/jars/gemspec_pom.rb: only whitespace content allowed before start tag and not # (position: START_DOCUMENT seen #... @1:1)  @ line 1, column 1
 @ 
[ERROR] The build could not read 1 project -> [Help 1]
org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
[FATAL] Non-parseable POM /Users/joaoduarte/experiments/startup_speed/logstash/vendor/bundle/jruby/2.2.0/gems/jar-dependencies-0.3.2/lib/jars/gemspec_pom.rb: only whitespace content allowed before start tag and not # (position: START_DOCUMENT seen #... @1:1)  @ line 1, column 1

    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:422)
    at org.apache.maven.graph.DefaultGraphBuilder.collectProjects(DefaultGraphBuilder.java:419)
    at org.apache.maven.graph.DefaultGraphBuilder.getProjectsForMavenReactor(DefaultGraphBuilder.java:410)
    at org.apache.maven.graph.DefaultGraphBuilder.build(DefaultGraphBuilder.java:83)
    at org.apache.maven.DefaultMaven.buildGraph(DefaultMaven.java:491)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:219)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
    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)
[ERROR]   
[ERROR]   The project  (/Users/joaoduarte/experiments/startup_speed/logstash/vendor/bundle/jruby/2.2.0/gems/jar-dependencies-0.3.2/lib/jars/gemspec_pom.rb) has 1 error
[ERROR]     Non-parseable POM /Users/joaoduarte/experiments/startup_speed/logstash/vendor/bundle/jruby/2.2.0/gems/jar-dependencies-0.3.2/lib/jars/gemspec_pom.rb: only whitespace content allowed before start tag and not # (position: START_DOCUMENT seen #... @1:1)  @ line 1, column 1 -> [Help 2]
org.apache.maven.model.io.ModelParseException: only whitespace content allowed before start tag and not # (position: START_DOCUMENT seen #... @1:1) 
    at org.apache.maven.model.io.DefaultModelReader.read(DefaultModelReader.java:130)
    at org.apache.maven.model.io.DefaultModelReader.read(DefaultModelReader.java:94)
    at org.apache.maven.model.building.DefaultModelProcessor.read(DefaultModelProcessor.java:81)
    at org.apache.maven.model.building.DefaultModelBuilder.readModel(DefaultModelBuilder.java:529)
    at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:269)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:469)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:438)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:401)
    at org.apache.maven.graph.DefaultGraphBuilder.collectProjects(DefaultGraphBuilder.java:419)
    at org.apache.maven.graph.DefaultGraphBuilder.getProjectsForMavenReactor(DefaultGraphBuilder.java:410)
    at org.apache.maven.graph.DefaultGraphBuilder.build(DefaultGraphBuilder.java:83)
    at org.apache.maven.DefaultMaven.buildGraph(DefaultMaven.java:491)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:219)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
    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: org.codehaus.plexus.util.xml.pull.XmlPullParserException: only whitespace content allowed before start tag and not # (position: START_DOCUMENT seen #... @1:1) 
    at org.codehaus.plexus.util.xml.pull.MXParser.parseProlog(MXParser.java:1557)
    at org.codehaus.plexus.util.xml.pull.MXParser.nextImpl(MXParser.java:1436)
    at org.codehaus.plexus.util.xml.pull.MXParser.next(MXParser.java:1131)
    at org.apache.maven.model.io.xpp3.MavenXpp3ReaderEx.read(MavenXpp3ReaderEx.java:4354)
    at org.apache.maven.model.io.xpp3.MavenXpp3ReaderEx.read(MavenXpp3ReaderEx.java:560)
    at org.apache.maven.model.io.DefaultModelReader.read(DefaultModelReader.java:121)
    ... 25 more
[ERROR] 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/ModelParseException

It seems the gemspec_pom.rb isn't being evaluated at all but read AS-IS. if I remove the comment line from the rb file I get an error at the first code letter of the first eval statement in gemspec_pom.rb:

org.apache.maven.model.io.ModelParseException: only whitespace content allowed before start tag and not e (position: START_DOCUMENT seen e... @1:1)

mkristian commented 8 years ago

I am not sure if this related: https://github.com/jruby/jruby/issues/3676 jar-dependencies installs the right right ruby-maven gem if not available but with jruby-9.0.5.0 this does not work, as the one bundled with jruby is NOT the right one for jar-dependencies and the installed one is not used.

does jruby-9.0.4.0 works for you ? if not then there is some other issue going on here, why the ruby DSL for poms gets not activated.

jsvd commented 8 years ago

@mkristian jruby 9.0.4.0 works for me, but 9.0.5.0 throws the above

jsvd commented 8 years ago

It seems 9.0.5.0 started using 0.2.x instead of 0.1.x

% git diff 9.0.4.0 9.0.5.0 -S jar-dependencies --name-status
M       lib/pom.rb
M       lib/pom.xml
M       pom.rb
M       pom.xml
% git diff 9.0.4.0 9.0.5.0 | grep jar-dependencies
-   ImportedGem.new( 'jar-dependencies', '0.1.15', true ),
+   ImportedGem.new( 'jar-dependencies', '${jar-dependencies.version}' ),
       <artifactId>jar-dependencies</artifactId>
+      <version>${jar-dependencies.version}</version>
+              'jar-dependencies.version' => '0.2.3',
+    <jar-dependencies.version>0.2.3</jar-dependencies.version>
mkristian commented 8 years ago

@jsvd if 9.0.4.0 works for you means the version of jar-dependencies coming with jruby-9.0.5.0 does not work. picking jar-dependencies-0.1.15 will work as well.

or using RVM which installs jruby-9.0.5.0 from source distribution (did not verify this though). the binary distribution of jruby-9.0.5.0 is broken as it forces it preinstalled ruby-maven and there is no way sane way around this.

will be fixed for next jruby version : 9.1.0.0

jsvd commented 8 years ago

digging a bit more, I'm not sure it's a problem with the packaged version of jar-dependencies, as the bootstrap scripts in logstash update all gems before executing the other setup tasks. So while 9.0.5.0 ships with jar-dependencies 0.2.3, it generates an error from 0.3.2 (as shown in the log).

I've checked that when using either jruby .4 or .5, the versions are the same for jar-dependencies and ruby-maven:

mkristian commented 8 years ago

the problem are not the installed gems but the ruby-maven from $JRUBY_HOME/lib/ruby/stdlib which contains the ruby-maven files.

ruby -e 'require "ruby_maven";p Gem.loaded_specs'

which gives for jruby-9.0.4.0

{"ruby-maven-libs"=>#<Gem::Specification:0x7d2 ruby-maven-libs-3.3.3>, "ruby-maven"=>#<Gem::Specification:0x7d4 ruby-maven-3.3.8>}

and for 9.0.50

{}

so with 9.0.5.0 you can use any ruby-maven gem, it ALWAYS will use the ruby-maven from $JRUBY_HOME/lib/ruby/stdlib

jsvd commented 8 years ago

I see. so the fix is in 9.1? if so this can be closed. I've tried to test the latest 9.1 snapshot but it is crashing for me.

mkristian commented 8 years ago

let me quickly push the fix on jruby master :) - did not do it since travis is too red for me as occasional committer - but it should be safe to do

mkristian commented 8 years ago

@jsvd fixed on jruby master. not sure I can trigger a new snapshot build

jsvd commented 8 years ago

@mkristian no worries. thanks for the awesome feedback and quick fix <3

jsvd commented 8 years ago

@mkristian unfortunately I'm still having this issue in jruby 1.7.24 https://github.com/elastic/logstash/issues/4818 This seems related to https://github.com/mkristian/jar-dependencies/issues/25 although I see no failed loading of jars when enabling debug. see output of the maven command in https://gist.github.com/jsvd/758e3d4beefcf035d051