Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jrubyexec task yaml load error with 9.0.0.0.pre2 #113

Closed
hleeldc opened this issue May 5, 2015 · 6 comments
Closed

jrubyexec task yaml load error with 9.0.0.0.pre2 #113

hleeldc opened this issue May 5, 2015 · 6 comments
Labels

Comments

@hleeldc
Copy link

hleeldc commented May 5, 2015

I have a directory with 2 files:

  • build.gradle
  • test.rb

Here's the content of build.gradle:

plugins {
    id "com.github.jruby-gradle.base" version "0.1.15"
}

jruby.execVersion '9.0.0.0.pre2'

import com.github.jrubygradle.JRubyExec

task run(type: JRubyExec) {
    script 'test.rb'
}

test.rb contains just one line:

require 'yaml'

Executing "gradle run" returns the following error:

:run
uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:1:in `require':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
LoadError: load error: psych -- java.lang.NullPointerException: null
...

It works if I remove the jruby.execVersion line, but then it falls back to jruby-complete 1.7.19.

Any idea?

@rtyler
Copy link
Member

rtyler commented May 5, 2015

This definitely looks like it might be an issue with the jruby-complete archive for 9000pre2. If you set the Java flag debug.fullTrace=false that might show you more information (unless @headius meant a different flag)

@hleeldc
Copy link
Author

hleeldc commented May 5, 2015

I'm not sure if the problem is in the jruby-complete archive because the following works fine.

java -cp ~/.gradle/caches/modules-2/files-2.1/org.jruby/jruby-complete/9.0.0.0.pre2/5c21f8a488eda22f4dad9e92431a6754fb0acd77/jruby-complete-9.0.0.0.pre2.jar org.jruby.Main test.rb

BTW, gradle run -Ddebug.fullTrace=false didn't output more information.

@enebo
Copy link

enebo commented May 5, 2015

@hleeldc @rtyler You can -Djruby.debug.fullTrace=true. I tend to use -Djruby.backtrace.style=raw for internal Java backtrace errors, but I think the former nests both Ruby and Java trace elements together.

@rtyler rtyler added the bug label May 6, 2015
@rtyler
Copy link
Member

rtyler commented May 6, 2015

@enebo @headius I've taken @hleeldc's example and found that I only get errors with pre2, but I'm not able to get the stacktraces from it.

Here's an example run with pre1:

➜  base-113  ./gradlew run --info
Starting Build
Settings evaluated using empty settings script.
Projects loaded. Root project using build file '/home/tyler/source/github/jruby-gradle/base-113/build.gradle'.
Included projects: [root project 'base-113']
Evaluating root project 'base-113' using build file '/home/tyler/source/github/jruby-gradle/base-113/build.gradle'.
Compiling build file '/home/tyler/source/github/jruby-gradle/base-113/build.gradle' using StatementExtractingScriptTransformer.
Compiling build file '/home/tyler/source/github/jruby-gradle/base-113/build.gradle' using BuildScriptTransformer.
All projects evaluated.
Selected primary task 'run' from project :
Tasks to be executed: [task ':run']
:run (Thread[main,5,main]) started.
:run
Executing task ':run' (up-to-date check took 0.001 secs) due to:
  Task has not declared any outputs.
Starting process 'command '/usr/lib/jvm/java-7-openjdk-amd64/bin/java''. Working directory: /home/tyler/source/github/jruby-gradle/base-113 Command: /usr/lib/jvm/java-7-openjdk-amd64/bin/java -Djruby.backtrace.style=true -Djruby.debug.fullTrace=true -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant -cp /home/tyler/.gradle/caches/modules-2/files-2.1/org.jruby/jruby-complete/9.0.0.0.pre1/72e55dd79f802c6e299460c22df6287b1dfdb424/jruby-complete-9.0.0.0.pre1.jar:/home/tyler/.gradle/caches/modules-2/files-2.1/org.bouncycastle/bcprov-jdk15on/1.50/be504b4901d75cbe129a178f5830e6c358ec214c/bcprov-jdk15on-1.50.jar org.jruby.Main /home/tyler/source/github/jruby-gradle/base-113/test.rb
Successfully started process 'command '/usr/lib/jvm/java-7-openjdk-amd64/bin/java''
Working on 9.0.0.0.pre1
:run (Thread[main,5,main]) completed. Took 7.19 secs.

BUILD SUCCESSFUL

Total time: 11.701 secs
➜  base-113  

Here's with pre2:

➜  base-113  ./gradlew run --info
Starting Build
Settings evaluated using empty settings script.
Projects loaded. Root project using build file '/home/tyler/source/github/jruby-gradle/base-113/build.gradle'.
Included projects: [root project 'base-113']
Evaluating root project 'base-113' using build file '/home/tyler/source/github/jruby-gradle/base-113/build.gradle'.
Compiling build file '/home/tyler/source/github/jruby-gradle/base-113/build.gradle' using StatementExtractingScriptTransformer.
Compiling build file '/home/tyler/source/github/jruby-gradle/base-113/build.gradle' using BuildScriptTransformer.
All projects evaluated.
Selected primary task 'run' from project :
Tasks to be executed: [task ':run']
:run (Thread[main,5,main]) started.
:run
Executing task ':run' (up-to-date check took 0.001 secs) due to:
  Task has not declared any outputs.
Starting process 'command '/usr/lib/jvm/java-7-openjdk-amd64/bin/java''. Working directory: /home/tyler/source/github/jruby-gradle/base-113 Command: /usr/lib/jvm/java-7-openjdk-amd64/bin/java -Djruby.backtrace.style=true -Djruby.debug.fullTrace=true -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant -cp /home/tyler/.gradle/caches/modules-2/files-2.1/org.jruby/jruby-complete/9.0.0.0.pre2/5c21f8a488eda22f4dad9e92431a6754fb0acd77/jruby-complete-9.0.0.0.pre2.jar:/home/tyler/.gradle/caches/modules-2/files-2.1/org.bouncycastle/bcprov-jdk15on/1.50/be504b4901d75cbe129a178f5830e6c358ec214c/bcprov-jdk15on-1.50.jar org.jruby.Main /home/tyler/source/github/jruby-gradle/base-113/test.rb
Successfully started process 'command '/usr/lib/jvm/java-7-openjdk-amd64/bin/java''
uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:1:in `require':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
LoadError: load error: psych -- java.lang.NullPointerException: null
  require at org/jruby/RubyKernel.java:966
  require at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:54
    <top> at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/yaml.rb:5
  require at org/jruby/RubyKernel.java:966
   (root) at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:1
    <top> at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:54
:run FAILED
:run (Thread[main,5,main]) completed. Took 6.434 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':run'.
> Process 'command '/usr/lib/jvm/java-7-openjdk-amd64/bin/java'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.

BUILD FAILED

Total time: 11.265 secs
➜  base-113  

I've placed the repro case in this gist which can be executed with Gradle 2.1+

mkristian added a commit that referenced this issue Jun 26, 2015
basically it sets up the jars in the same manner as it would pack it inside a jar
and uses the usual loading semantic for loading jars with jruby. and with this
the jrubyExec task does not need interfer with those embedded jars coming with
jruby itself like bouncycastle jars, jline jar or snakeyaml jar.

fixes #123 and #113
mkristian added a commit that referenced this issue Jul 1, 2015
basically it sets up the jars in the same manner as it would pack it inside a jar
and uses the usual loading semantic for loading jars with jruby. and with this
the jrubyExec task does not need interfer with those embedded jars coming with
jruby itself like bouncycastle jars, jline jar or snakeyaml jar.

fixes #123 and #113
@ysb33r
Copy link
Contributor

ysb33r commented Jul 6, 2015

Has anyone tried this yet with 9.0.0.0.rc-1 ?

@mkristian
Copy link
Contributor

actually this is not a problem with jrubyExec anymore after #123 got merged since all jars are loaded via require including snakeyaml.jar from psych.

removing this line keeps those require_jar working: 5d59833#diff-b881b1c59e2fb0993fddd8f8a361cc0cL115

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

5 participants