Rake/rspec can not work with with Jruby-complete-jar 1.7.x

Hi All,

I got the following issue with RSpec::Core::RakeTask when trying
upgrade from JRuby-1.6.8 to 1.7.3 (and having same issue on 1.7.1, 1.7.2
and 1.7.0 too). I am using jruby-rake-plugin (maven) to install gems
and execute rspec tests. It works great on JRuby 1.6.7.2 and 1.6.8 but
failed with following error with JRuby 1.7.x. I then tried to compare
the version of the gems installed of the two versions and they are
exactly the same version. I remove all of our spec tests leaving just
a trivial one (like true.should be_true) and the error still came. I
then try to run that simple spec alone directly (not via rake file)
using the jruby complete jar and it works.

So looks like my rake task is the problem when it run on JRuby-1.7.x
complete jar. I tried to search around for a day but it looks like no
one is having a same issue like me with JRuby 1.7.x. So I think it
should not be a bug of JRuby. I am leaning toward the thought is that
this is actually not a an issue for everybody but very curious to know
why just a simple combination (Jruby-complete jar, rake and rspec) could
fail. Is there anybody out there doing a same thing like me (and
successful)?

Here is my RakeTask file, it is actually stupid simple:

RSpec::Core::RakeTask.new do |t|
t.pattern = ‘*_spec.rb’
t.verbose = true
end
task :default => :spec

And here are version of gems:

diff-lcs-1.2.2
rake-10.0.4
rspec-2.13.0
rspec-core-2.13.1
rspec-expectations-2.13.0
rspec-mocks-2.13.0

And the error trace:

[INFO] — jruby-rake-plugin:1.7.3:rake (ruby_rspec_test) @ bayer-hco

[INFO] rake already installed
[WARNING] ** Invoke default (first_time)
[WARNING] ** Invoke spec (first_time)
[WARNING] ** Execute spec
[INFO]
file:/home/tmai/.m2/repository/org/jruby/jruby-complete/1.7.3/jruby-complete-1.7.3.jar!/META-INF/jruby.home/bin/jruby
-S rspec org_graph_spec.rb
[WARNING] rake aborted!
[WARNING]
file:/home/tmai/.m2/repository/org/jruby/jruby-complete/1.7.3/jruby-complete-1.7.3.jar!/META-INF/jruby.home/bin/jruby
-S rspec org_graph_spec.rb failed
[WARNING]
/home/tmai/.gem/jruby/1.9/gems/rspec-core-2.13.1/lib/rspec/core/rake_task.rb:156:in
run_task' [WARNING] /home/tmai/.gem/jruby/1.9/gems/rspec-core-2.13.1/lib/rspec/core/rake_task.rb:124:ininitialize’
[WARNING]
/home/tmai/.gem/jruby/1.9/gems/rake-10.0.4/lib/rake/file_utils_ext.rb:58:in
verbose' [WARNING] org/jruby/RubyBasicObject.java:1683:insend
[WARNING] org/jruby/RubyKernel.java:2107:in send' [WARNING] /home/tmai/.gem/jruby/1.9/gems/rspec-core-2.13.1/lib/rspec/core/rake_task.rb:122:ininitialize’
[WARNING] org/jruby/RubyProc.java:249:in call' [WARNING] /home/tmai/.gem/jruby/1.9/gems/rake-10.0.4/lib/rake/task.rb:246:inexecute’
[WARNING] org/jruby/RubyArray.java:1613:in each' [WARNING] /home/tmai/.gem/jruby/1.9/gems/rake-10.0.4/lib/rake/task.rb:241:inexecute’
[WARNING]
/home/tmai/.gem/jruby/1.9/gems/rake-10.0.4/lib/rake/task.rb:184:in
invoke_with_call_chain' [WARNING] jar:file:/home/tmai/.m2/repository/org/jruby/jruby-complete/1.7.3/jruby-complete-1.7.3.jar!/META-INF/jruby.home/lib/ruby/1.9/monitor.rb:211:inmon_synchronize’
[WARNING]
/home/tmai/.gem/jruby/1.9/gems/rake-10.0.4/lib/rake/task.rb:177:in
invoke_with_call_chain' [WARNING] /home/tmai/.gem/jruby/1.9/gems/rake-10.0.4/lib/rake/task.rb:205:ininvoke_prerequisites’
[WARNING] org/jruby/RubyArray.java:1613:in each' [WARNING] /home/tmai/.gem/jruby/1.9/gems/rake-10.0.4/lib/rake/task.rb:203:ininvoke_prerequisites’
[WARNING]
/home/tmai/.gem/jruby/1.9/gems/rake-10.0.4/lib/rake/task.rb:183:in
invoke_with_call_chain' [WARNING] jar:file:/home/tmai/.m2/repository/org/jruby/jruby-complete/1.7.3/jruby-complete-1.7.3.jar!/META-INF/jruby.home/lib/ruby/1.9/monitor.rb:211:inmon_synchronize’
[WARNING]
/home/tmai/.gem/jruby/1.9/gems/rake-10.0.4/lib/rake/task.rb:177:in
invoke_with_call_chain' [WARNING] /home/tmai/.gem/jruby/1.9/gems/rake-10.0.4/lib/rake/task.rb:170:ininvoke’
[WARNING]
/home/tmai/.gem/jruby/1.9/gems/rake-10.0.4/lib/rake/application.rb:143:in
invoke_task' [WARNING] /home/tmai/.gem/jruby/1.9/gems/rake-10.0.4/lib/rake/application.rb:101:intop_level’
[WARNING] org/jruby/RubyArray.java:1613:in each' [WARNING] /home/tmai/.gem/jruby/1.9/gems/rake-10.0.4/lib/rake/application.rb:101:intop_level’
[WARNING]
/home/tmai/.gem/jruby/1.9/gems/rake-10.0.4/lib/rake/application.rb:110:in
run_with_threads' [WARNING] /home/tmai/.gem/jruby/1.9/gems/rake-10.0.4/lib/rake/application.rb:95:intop_level’
[WARNING]
/home/tmai/.gem/jruby/1.9/gems/rake-10.0.4/lib/rake/application.rb:73:in
run' [WARNING] /home/tmai/.gem/jruby/1.9/gems/rake-10.0.4/lib/rake/application.rb:160:instandard_exception_handling’
[WARNING]
/home/tmai/.gem/jruby/1.9/gems/rake-10.0.4/lib/rake/application.rb:70:in
run' [WARNING] /home/tmai/.gem/jruby/1.9/gems/rake-10.0.4/bin/rake:33:in(root)’
[WARNING] org/jruby/RubyKernel.java:1046:in load' [WARNING] /home/tmai/.gem/jruby/1.9/bin/rake:23:in(root)’
[WARNING] Tasks: TOP => default => spec

Any feedback is appreciated.

Best Regards

Thang

you could give
https://github.com/torquebox/jruby-maven-plugins/rake-maven-plugin
a trial. or even
https://github.com/torquebox/jruby-maven-plugins/rspec-maven-plugin

just have a look at the src/its of those plugins to look for example
pom.xml

  • christian

yes, Windows is problem since I can not test things on windows. if you
could run the same
$ mvn test -e
which could give me just enough hints to where the path-problem on
windows
lies.

I guess we should use

BTW you can run those test for a given list of jruby versions both in
1.8
or 1.9 mode :slight_smile: but I guess first the path-problem needs to be solved.

  • christian

Thank so much, Christian, for introducing these plugins. I tried them
and it works like a charm to my surprise I confess. Although it get
below error in Windows 7 but I think it is good enough for me now.

Thanks again

thang

[INFO] — rspec-maven-plugin:0.29.4:test (default) @ medtronic-cfg —
[INFO] Successfully installed rspec-2.7.0
[INFO] Successfully installed rspec-core-2.7.1
[INFO] Successfully installed rspec-expectations-2.7.0
[INFO] Successfully installed diff-lcs-1.1.3
[INFO] Successfully installed rspec-mocks-2.7.0
[INFO] 5 gems installed
[INFO]
[INFO] run with jruby 1.7.3
[INFO]
[WARNING] SyntaxError: -e:42: syntax error, unexpected tCOLON3
[WARNING]
[WARNING] ::RSpec::Core::Runner.disable_autorun!
[WARNING] ^
[INFO]

[INFO] BUILD FAILURE
[INFO]

[INFO] Total time: 22.293s
[INFO] Finished at: Wed Apr 03 17:27:28 EDT 2013
[INFO] Final Memory: 14M/180M
[INFO]

[ERROR] Failed to execute goal
de.saumya.mojo:rspec-maven-plugin:0.29.4:test (default) on project
medtronic-cfg: Unable to read test report file:
C:\Development\medtronic\medtronic-git\newgittrunk\target\rspec-report.html
→ [Help 1]


Thang Ngoc Mai – Senior Software Engineer - M (84) 977 758 911 –
twitter: thangmaikms
KMS Technology, Inc. ►
www.kms-technology.comhttp://www.kms-technology.com/

From: [email protected] [mailto:[email protected]] On
Behalf Of kristian
Sent: Wednesday, April 03, 2013 3:36 AM
To: [email protected]
Subject: Re: [jruby-user] rake/rspec can not work with with
Jruby-complete-jar 1.7.x

you could give
https://github.com/torquebox/jruby-maven-plugins/rake-maven-plugin
a trial. or even
https://github.com/torquebox/jruby-maven-plugins/rspec-maven-plugin
just have a look at the src/its of those plugins to look for example
pom.xml

  • christian

On Wed, Apr 3, 2013 at 10:26 AM, Thang Mai
<[email protected]mailto:[email protected]> wrote:
Hi All,

I got the following issue with RSpec::Core::RakeTask when trying
upgrade from JRuby-1.6.8 to 1.7.3 (and having same issue on 1.7.1, 1.7.2
and 1.7.0 too). I am using jruby-rake-plugin (maven) to install gems
and execute rspec tests. It works great on JRuby 1.6.7.2 and 1.6.8 but
failed with following error with JRuby 1.7.x. I then tried to compare
the version of the gems installed of the two versions and they are
exactly the same version. I remove all of our spec tests leaving just
a trivial one (like true.should be_true) and the error still came. I
then try to run that simple spec alone directly (not via rake file)
using the jruby complete jar and it works.

So looks like my rake task is the problem when it run on JRuby-1.7.x
complete jar. I tried to search around for a day but it looks like no
one is having a same issue like me with JRuby 1.7.x. So I think it
should not be a bug of JRuby. I am leaning toward the thought is that
this is actually not a an issue for everybody but very curious to know
why just a simple combination (Jruby-complete jar, rake and rspec) could
fail. Is there anybody out there doing a same thing like me (and
successful)?

Here is my RakeTask file, it is actually stupid simple:

RSpec::Core::RakeTask.new do |t|
t.pattern = ‘*_spec.rb’
t.verbose = true
end
task :default => :spec

And here are version of gems:

diff-lcs-1.2.2
rake-10.0.4
rspec-2.13.0
rspec-core-2.13.1
rspec-expectations-2.13.0
rspec-mocks-2.13.0

And the error trace:

[INFO] — jruby-rake-plugin:1.7.3:rake (ruby_rspec_test) @ bayer-hco

[INFO] rake already installed
[WARNING] ** Invoke default (first_time)
[WARNING] ** Invoke spec (first_time)
[WARNING] ** Execute spec
[INFO]
file:/home/tmai/.m2/repository/org/jruby/jruby-complete/1.7.3/jruby-complete-1.7.3.jar!/META-INF/jruby.home/bin/jruby
-S rspec org_graph_spec.rb
[WARNING] rake aborted!
[WARNING]
file:/home/tmai/.m2/repository/org/jruby/jruby-complete/1.7.3/jruby-complete-1.7.3.jar!/META-INF/jruby.home/bin/jruby
-S rspec org_graph_spec.rb failed
[WARNING]
/home/tmai/.gem/jruby/1.9/gems/rspec-core-2.13.1/lib/rspec/core/rake_task.rb:156:in
run_task' [WARNING] /home/tmai/.gem/jruby/1.9/gems/rspec-core-2.13.1/lib/rspec/core/rake_task.rb:124:in initialize’
[WARNING]
/home/tmai/.gem/jruby/1.9/gems/rake-10.0.4/lib/rake/file_utils_ext.rb:58:in
verbose' [WARNING] org/jruby/RubyBasicObject.java:1683:in send
[WARNING] org/jruby/RubyKernel.java:2107:in send' [WARNING] /home/tmai/.gem/jruby/1.9/gems/rspec-core-2.13.1/lib/rspec/core/rake_task.rb:122:in initialize’
[WARNING] org/jruby/RubyProc.java:249:in call' [WARNING] /home/tmai/.gem/jruby/1.9/gems/rake-10.0.4/lib/rake/task.rb:246:in execute’
[WARNING] org/jruby/RubyArray.java:1613:in each' [WARNING] /home/tmai/.gem/jruby/1.9/gems/rake-10.0.4/lib/rake/task.rb:241:in execute’
[WARNING]
/home/tmai/.gem/jruby/1.9/gems/rake-10.0.4/lib/rake/task.rb:184:in
invoke_with_call_chain' [WARNING] jar:file:/home/tmai/.m2/repository/org/jruby/jruby-complete/1.7.3/jruby-complete-1.7.3.jar!/META-INF/jruby.home/lib/ruby/1.9/monitor.rb:211:in mon_synchronize’
[WARNING]
/home/tmai/.gem/jruby/1.9/gems/rake-10.0.4/lib/rake/task.rb:177:in
invoke_with_call_chain' [WARNING] /home/tmai/.gem/jruby/1.9/gems/rake-10.0.4/lib/rake/task.rb:205:in invoke_prerequisites’
[WARNING] org/jruby/RubyArray.java:1613:in each' [WARNING] /home/tmai/.gem/jruby/1.9/gems/rake-10.0.4/lib/rake/task.rb:203:in invoke_prerequisites’
[WARNING]
/home/tmai/.gem/jruby/1.9/gems/rake-10.0.4/lib/rake/task.rb:183:in
invoke_with_call_chain' [WARNING] jar:file:/home/tmai/.m2/repository/org/jruby/jruby-complete/1.7.3/jruby-complete-1.7.3.jar!/META-INF/jruby.home/lib/ruby/1.9/monitor.rb:211:in mon_synchronize’
[WARNING]
/home/tmai/.gem/jruby/1.9/gems/rake-10.0.4/lib/rake/task.rb:177:in
invoke_with_call_chain' [WARNING] /home/tmai/.gem/jruby/1.9/gems/rake-10.0.4/lib/rake/task.rb:170:in invoke’
[WARNING]
/home/tmai/.gem/jruby/1.9/gems/rake-10.0.4/lib/rake/application.rb:143:in
invoke_task' [WARNING] /home/tmai/.gem/jruby/1.9/gems/rake-10.0.4/lib/rake/application.rb:101:in top_level’
[WARNING] org/jruby/RubyArray.java:1613:in each' [WARNING] /home/tmai/.gem/jruby/1.9/gems/rake-10.0.4/lib/rake/application.rb:101:in top_level’
[WARNING]
/home/tmai/.gem/jruby/1.9/gems/rake-10.0.4/lib/rake/application.rb:110:in
run_with_threads' [WARNING] /home/tmai/.gem/jruby/1.9/gems/rake-10.0.4/lib/rake/application.rb:95:in top_level’
[WARNING]
/home/tmai/.gem/jruby/1.9/gems/rake-10.0.4/lib/rake/application.rb:73:in
run' [WARNING] /home/tmai/.gem/jruby/1.9/gems/rake-10.0.4/lib/rake/application.rb:160:in standard_exception_handling’
[WARNING]
/home/tmai/.gem/jruby/1.9/gems/rake-10.0.4/lib/rake/application.rb:70:in
run' [WARNING] /home/tmai/.gem/jruby/1.9/gems/rake-10.0.4/bin/rake:33:in (root)’
[WARNING] org/jruby/RubyKernel.java:1046:in load' [WARNING] /home/tmai/.gem/jruby/1.9/bin/rake:23:in (root)’
[WARNING] Tasks: TOP => default => spec

Any feedback is appreciated.

Best Regards

Thang