Problem with RSpec+Maven+jruby-complete.jar

Hi,

I’m trying to run RSpec from Maven through the jruby-rake-plugin. I’m
getting an error where the plugin is looking for bin/spec:

[INFO] Error opening script file: /Users/mario/Desktop/
abstra.cc/projects/BMClient/file:/Users/mario/.m2/repository/org/jruby/jruby-complete/1.4.0/jruby-complete-1.4.0.jar!/META-INF/jruby.home/lib/ruby/gems/1.8/gems/rspec-1.2.9/bin/spec(No
such file or directory)
[WARNING] rake aborted!
[WARNING] Command
file:/Users/mario/.m2/repository/org/jruby/jruby-complete/1.4.0/jruby-complete-1.4.0.jar!/META-INF/jruby.home/bin/jruby
-I"src/main/ruby/app:src/main/ruby/conf"
“file:/Users/mario/.m2/repository/org/jruby/jruby-complete/1.4.0/jruby-complete-1.4.0.jar!/META-INF/jruby.home/lib/ruby/gems/1.8/gems/rspec-1.2.9/bin/spec”
“src/test/ruby/spec/core/backend_spec.rb”
“src/test/ruby/spec/core/model_spec.rb” --format specdoc failed

and of course, bin/spec doesn’t exist in jruby-complete.jar.

A workaround for the moment is to have a full instalation if JRuby and
do a
-Djruby.home when calling mvn, but that’s a stopgap measure. Any ideas?
Should I report this as a bug?

Here’s the relevant part of my pom.xml. jruby.version is set to 1.4.0:

src/main/scala src/test/scala src/main/ruby org.jruby.plugins jruby-rake-plugin ${jruby.version} install-gems process-resources install-gems ${gem.options} ${required.gems} ${testing.required.gems} clobber clean rake ${basedir} clobber runtests test rake ${basedir} spec rdoc verify rake ${basedir} rdoc

-Mario.

Mario, where or when did you get that jar? I just downloaded the version
in
repo2.maven.org and it contains the spec file:

david@david-mirai ~/dev/jruby$ jar -tf

/home/david/Downloads/jruby-complete-1.4.0.jar
META-INF/jruby.home/lib/ruby/gems/1.8/gems/rspec-1.2.9/bin/spec
META-INF/jruby.home/lib/ruby/gems/1.8/gems/rspec-1.2.9/bin/spec

It’s also included in the development version:

david@david-mirai ~/dev/jruby$ jar -tf lib/jruby-complete.jar

META-INF/jruby.home/lib/ruby/gems/1.8/gems/rspec-1.2.9/bin/spec
META-INF/jruby.home/lib/ruby/gems/1.8/gems/rspec-1.2.9/bin/spec

There’s also a maven-rspec-plugin that I’ve used in the past.

Works okay, but not awesome.

I’ve added some hacks so you can run specs outside of maven, but still
get your maven-managed classpath also. After the first run involving
maven, you’re left with a target/spec-runner.rb you can use to execute
individual specs. (If I recall).

-Bob

If the goal is writing / running tests – I have been using JtestR
successfully for quite some time, in a large maven 2 project. It has
maven plugin and comes with many test tools bundled in (for example,
Mocha, which I use for mocking.)

http://jtestr.codehaus.org/

Cheers,
Chiaming H.

----- Original Message ----
From: kristian [email protected]
To: [email protected]
Sent: Tue, November 10, 2009 7:43:46 AM
Subject: Re: [jruby-user] Problem with RSpec+Maven+jruby-complete.jar

maybe you want to try yet another maven plugin: I added a spec tasks
to the rails-maven-plugin and it works also without rails

http://github.com/mkristian/rails-maven-plugin

how to use it you can find either under
src/it/demo

or in

with regards
Kristian

On Tue, Nov 10, 2009 at 9:09 PM, Bob McWhirter [email protected] wrote:

repo2.maven.org and it contains the spec file:

META-INF/jruby.home/lib/ruby/gems/1.8/gems/rspec-1.2.9/bin/spec
[WARNING] rake aborted!
Here’s the relevant part of my pom.xml. jruby.version is set to 1.4.0:
org.jruby.plugins
${testing.required.gems}



David C.
http://www.thinkincode.net


Kristian Meier + Saumya Sharma + Sanuka Meier
Vadakkethu House,
Edayanmula West PO - 689532,
Pathanamthitta District, Kerala, INDIA

tel: +91 468 2319577

protect your privacy while searching the net: www.ixquick.com

         _=_
       q(-_-)p
        '_) (_`
        /__/  \
     _(<_   / )_
  (__\_\_|_/__)

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

maybe you want to try yet another maven plugin: I added a spec tasks
to the rails-maven-plugin and it works also without rails

http://github.com/mkristian/rails-maven-plugin

how to use it you can find either under
src/it/demo

or in

with regards
Kristian

On Tue, Nov 10, 2009 at 9:09 PM, Bob McWhirter [email protected] wrote:

repo2.maven.org and it contains the spec file:

META-INF/jruby.home/lib/ruby/gems/1.8/gems/rspec-1.2.9/bin/spec
[WARNING] rake aborted!
Here’s the relevant part of my pom.xml. jruby.version is set to 1.4.0:
     org.jruby.plugins
${testing.required.gems}
      Â
      Â
      Â


David C.
http://www.thinkincode.net


Kristian Meier + Saumya Sharma + Sanuka Meier
Vadakkethu House,
Edayanmula West PO - 689532,
Pathanamthitta District, Kerala, INDIA

tel: +91 468 2319577

protect your privacy while searching the net: www.ixquick.com

         _=_
       q(-_-)p
        '_) (_`
        /__/  \
     _(<_   / )_
  (__\_\_|_/__)

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Looking in my jruby-complete.jar I see that it does indeed include
bin/spec.
However, the problem looks to be the way the jruby-rake-plugin sets up
the
load path. Look at the first error line:

[INFO] Error opening script file: /Users/mario/Desktop/
abstra.cc/projects/BMClient/file:/Users/mario/.m2/repository/org/jruby/jruby-complete/1.4.0/jruby-complete-1.4.0.jar!/META-INF/jruby.home/lib/ruby/gems/1.8/gems/rspec-1.2.9/bin/spec(No
such file or directory)

For some reason it’s prepending either the CWD or the directory where
the
pom.xml file resides to the file: URL.

-Mario.


I want to change the world but they won’t give me the source code.

try to remove in your pom.xml

${basedir}

that could cause the problem.

I remember that I spent quite some time to rectify the behavior of the
launchdirectory in jruby-rake-plugin (which I cloned for the
rails-maven-plugin) to work probably in various maven scenarios
(reactor, etc)

regards Kristian

On Tue, Nov 10, 2009 at 11:41 PM, Mario C. [email protected]
wrote:

david@david-mirai ~/dev/jruby$ jar -tf

file:/Users/mario/.m2/repository/org/jruby/jruby-complete/1.4.0/jruby-complete-1.4.0.jar!/META-INF/jruby.home/bin/jruby
   src/main/scala
     ${jruby.version}
     Â
     Â
     Â
    Â

David C.
http://www.thinkincode.net


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Feel free to file bugs and/or patches for the jruby-rake-plugin. I
wrote it quite a while ago but don’t use it heavily, and thus I don’t
know whether it works well for others and don’t promote it very much
(hence the lack of documentation).

/Nick

On Tue, Nov 10, 2009 at 11:19 PM, kristian [email protected] wrote:

pom.xml file resides to the file: URL.

Mario, where or when did you get that jar? I just downloaded the version

META-INF/jruby.home/lib/ruby/gems/1.8/gems/rspec-1.2.9/bin/spec
(No such file or directory)
Should I report this as a bug?

${gem.options} ${required.gems}
clobber
spec
rdoc

http://xircles.codehaus.org/manage_email


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

@Nick

I submitted some patches. I would like to add following more to reach
something we can use for datamapper but first want to hear some
feedback:

  • allow to configure the GEM_HOME,GEM_PATH via properties in the
    settings.xml and use it for the forked jruby
  • add my rspec goal to the rake-plugin
  • allow to use nailgun for the forked

I guess I have more ideas but only limited time.

with regards
Kristian

On Wed, Nov 11, 2009 at 10:49 PM, Nick S. [email protected]
wrote:

 ${basedir}
On Tue, Nov 10, 2009 at 11:41 PM, Mario C. [email protected] wrote:

david@david-mirai ~/dev/jruby$ jar -tf

file:/Users/mario/.m2/repository/org/jruby/jruby-complete/1.4.0/jruby-complete-1.4.0.jar!/META-INF/jruby.home/bin/jruby
   src/main/scala
     ${jruby.version}
     Â
     Â
     Â
    Â


To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email


Kristian Meier + Saumya Sharma + Sanuka Meier
Vadakkethu House,
Edayanmula West PO - 689532,
Pathanamthitta District, Kerala, INDIA

tel: +91 468 2319577

protect your privacy while searching the net: www.ixquick.com

         _=_
       q(-_-)p
        '_) (_`
        /__/  \
     _(<_   / )_
  (__\_\_|_/__)

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

can please send the pom.xml

thanx Kristian

On Tue, Nov 17, 2009 at 12:39 AM, Stuart Sierra
[email protected] wrote:

Changing the launchDirectory parameter didn’t help.

-SS


To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email


Kristian Meier + Saumya Sharma + Sanuka Meier
Vadakkethu House,
Edayanmula West PO - 689532,
Pathanamthitta District, Kerala, INDIA

tel: +91 468 2319577

protect your privacy while searching the net: www.ixquick.com

         _=_
       q(-_-)p
        '_) (_`
        /__/  \
     _(<_   / )_
  (__\_\_|_/__)

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

In case it helps, here’s mine in full.

HTH,
-Mario.


I want to change the world but they won’t give me the source code.

On Tue, Nov 10, 2009 at 1:11 PM, Mario C. [email protected]
wrote:

For some reason it’s prepending either the CWD or the directory where the
pom.xml file resides to the file: URL.

I have the same problem running Test::Unit via jruby-rake-plugin.
Maven fails with:

[INFO] Error opening script file:
/path/to/my/project/file:/home/stuart/.m2/repository/org/jruby/jruby-complete/1.4.0/jruby-complete-1.4.0.jar!/META-INF/jruby.home/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb

Changing the launchDirectory parameter didn’t help.

-SS


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

I filed I bug
http://jira.codehaus.org/browse/JRUBY-4238

On Tue, Nov 17, 2009 at 2:06 AM, kristian [email protected] wrote:

pom.xml file resides to the file: URL.
-SS

      =

      =
     q(--)p
      '
) (`
      /__/ Â
    (<  / )

   (__|_/)


Kristian Meier + Saumya Sharma + Sanuka Meier
Vadakkethu House,
Edayanmula West PO - 689532,
Pathanamthitta District, Kerala, INDIA

tel: +91 468 2319577

protect your privacy while searching the net: www.ixquick.com

         _=_
       q(-_-)p
        '_) (_`
        /__/  \
     _(<_   / )_
  (__\_\_|_/__)

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

it boils down to
/usr/lib/jvm/java-6-openjdk/jre/bin/java -Xmx384m -classpath
/home/kristian/.m2/repository/org/jruby/jruby-complete/1.4.0/jruby-complete-1.4.0.jar
org.jruby.Main -S rake spec

does not work and produces your error.

but if you install rspec gem with the install-gems goal things work
(with me).

regards Kristian

On Tue, Nov 17, 2009 at 1:09 AM, Mario C. [email protected]
wrote:

can please send the pom.xml


     q(-_-)p


To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email


Kristian Meier + Saumya Sharma + Sanuka Meier
Vadakkethu House,
Edayanmula West PO - 689532,
Pathanamthitta District, Kerala, INDIA

tel: +91 468 2319577

protect your privacy while searching the net: www.ixquick.com

         _=_
       q(-_-)p
        '_) (_`
        /__/  \
     _(<_   / )_
  (__\_\_|_/__)

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Hi,

On Tue, Nov 17, 2009 at 5:34 AM, kristian [email protected] wrote:

I filed I bug
http://jira.codehaus.org/browse/JRUBY-4238

Thanks for filing the bugs!

I can easily reproduce the problem. It all boils down to the fact that
rake tries to execute rspec via external system() call, with
parameters like this:

file:/D:/work/jruby-dev/jruby/lib/jruby-complete.jar!/META-INF/jruby.home/bin/jruby.exe
-I"lib"
“file:/D:/work/jruby-dev/jruby/lib/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/gems/1.8/gems/rspec-1.2.9/bin/spec”
“./spec/t_spec.rb”.

Naturally, this is one ugly-looking command line! :slight_smile: The first
argument (the executable) is dealt with JRuby’s in-process launching
magic, so we don’t try to execute that binary, we just launch
in-process. The actual script, the third argument, is also not pretty:

“file:/D:/work/jruby-dev/jruby/lib/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/gems/1.8/gems/rspec-1.2.9/bin/spec”

And currently JRuby can’t execute scripts from JAR files. Try to run:

jruby
“file:/D:/work/jruby-dev/jruby/lib/jruby-complete.jar!/META-INF/jruby.home/lib/ruby/gems/1.8/gems/rspec-1.2.9/bin/spec”

You’ll get an error. I’m going to add this functionality to JRuby dev
version, so you could try it out.

Thanks,
–Vladimir

P.S. Actually, on Windows there is another problem, our in-process
magic doesn’t actually work there, since we don’t expect “jruby.exe”,
we only look for “ruby”. Will file a separate issue for that one. But
once both these issues fixed, you should be able to execute rake from
jruby-complete, and it will properly launch rspec.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

thanx

On Thu, Nov 19, 2009 at 8:01 PM, Vladimir S. [email protected]
wrote:

And executing the spec task via rake from jruby-complete.jar should


Kristian Meier + Saumya Sharma + Sanuka Meier
Vadakkethu House,
Edayanmula West PO - 689532,
Pathanamthitta District, Kerala, INDIA

tel: +91 468 2319577

protect your privacy while searching the net: www.ixquick.com

         _=_
       q(-_-)p
        '_) (_`
        /__/  \
     _(<_   / )_
  (__\_\_|_/__)

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Hi,

On Tue, Nov 17, 2009 at 5:34 AM, kristian [email protected] wrote:

I filed I bug
http://jira.codehaus.org/browse/JRUBY-4238

OK, so both bugs have been fixed:

And executing the spec task via rake from jruby-complete.jar should
work now, verified on Windows and Linux.

Thanks,
–Vladimir


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email