cucumber-attic / cuke4duke

Cucumber support for the JVM: Java, Scala, Groovy, Clojure, Ioke, Javascript, Spring, Guice, PicoContainer, WebDriver, Ant and Maven
http://wiki.github.com/aslakhellesoy/cuke4duke
MIT License
256 stars 72 forks source link

cuke4duke 0.4.2 in maven fails: no such file or directory #80

Closed mBread closed 14 years ago

mBread commented 14 years ago

When trying to run cuke4duke 0.4.2 in maven, I get this output:

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building quelea-cucumber 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- cuke4duke-maven-plugin:0.4.2:cucumber (default-cli) @ quelea-cucumber ---
[INFO] JRuby limited openssl loaded. http://jruby.org/openssl
[INFO] gem install jruby-openssl for full support.
[INFO] file:/Users/mbread/.m2/repository/org/jruby/jruby-complete/1.5.3/jruby-complete-1.5.3.jar!/META-INF/jruby.home/lib/ruby/site_rubSuccessfully installed cuke4duke-0.4.2
[INFO] 1 gem installed
[INFO] y/1.8/rubygems/installer.rb:388 warning: executable? does not in this environment and will return a dummy value
[INFO] Error opening script file: /Users/mbread/.m2/repository/.jruby/bin/cuke4duke (No such file or directory)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 38.013s
[INFO] Finished at: Tue Oct 12 10:05:32 BST 2010
[INFO] Final Memory: 2M/4M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal cuke4duke:cuke4duke-maven-plugin:0.4.2:cucumber (default-cli) on project quelea-cucumber: JRuby failed. Java returned: 1 -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[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/MojoExecutionException

where the key problem appears to be:

    Error opening script file: /Users/mbread/.m2/repository/.jruby/bin/cuke4duke (No such file or directory)

My pom file is taken from a maven-generated archetype, with the elements from http://github.com/aslakhellesoy/cuke4duke/wiki/Maven added, and the cuke4duke version changed to 0.4.2. (Very similar happens with versions 0.3.1 and 0.3.2.)

Any idea what's happening?

aslakhellesoy commented 14 years ago

Did you install the gems as described in the Bootstrapping section at http://github.com/aslakhellesoy/cuke4duke/wiki/Maven ?

mBread commented 14 years ago

Ah, sorry, I wasn't clear - it was as I was running that command that the issue arises.

aslakhellesoy commented 14 years ago

Just to be clear - you are passing -Dcucumber.installGems=true right?

mBread commented 14 years ago

yes: mvn -Dcucumber.installGems=true cuke4duke:cucumber

aslakhellesoy commented 14 years ago

Do both of your /Users/mbread/.m2/repository/.jruby/ and /Users/mbread/.m2/repository/.jruby/bin directories exist? What's in them?

mBread commented 14 years ago

The bin directory does not exist. The .jruby directory contains cache, doc, gems and specifications.

(Just a little more information if it helps: I'm running on MAC OS X 10.4, using bash, and I did not execute this command with root permissions. Maven v3.0, just downloaded. Java 1.5.0_19)

aslakhellesoy commented 14 years ago

Can you try to manually create the missing bin directory and try again? That should install the cuke4duke script in there.

mBread commented 14 years ago

That doesn't appear to make any difference. I get the same output, and nothing gets created in the bin directory.

aslakhellesoy commented 14 years ago

I just blew away my ~/.m2/repository/.jruby and ~/.m2/repository/cuke4duke to make sure I don't have anything installed.

Then I cd'ed to examples/java in the cuke4uke project and ran: mvn -Dcucumber.installGems=true integration-test. Everything ran fine, the gems got installed and I have several files under ~/.m2/repository/.jruby/bin - including the cuke4duke executable.

Can you try that? (I changed the goal from cuke4duke:cucumber to integration-test, but that shouldn't matter). Also make sure you pull the latest - I just did some minor changes to the java examples. You should be on revision 3cbb0710d53b964d246be1bcef991626d5c0d8ac

Does this work for you?

mBread commented 14 years ago

After deleting those directories, pulling that revision & running that command in the examples/java directory, I still get the same problem - no bin directory and the same error message: Error opening script file: /Users/mbread/.m2/repository/.jruby/bin/cuke4duke (No such file or directory) There is also this error (which also appeared before - I don't know if it's of interest to this issue): file:/Users/mbread/.m2/repository/org/jruby/jruby-complete/1.5.3/jruby-complete-1.5.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/installer.rb:388 warning: executable? does not in this environment and will return a dummy value

aslakhellesoy commented 14 years ago

That's very odd. Can you try to add --verbose to the gem installation process and post the output again?. (Add this to your POM):

<gem>install cuke4duke --verbose --version 0.4.2</gem>

Here is what I get:

[INFO] [jar:jar {execution: default-jar}]
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO] Building jar: /Users/aslakhellesoy/scm/cuke4duke/examples/java/target/cuke4duke-java-example-0.4.2.jar
[INFO] [cuke4duke:cucumber {execution: run-features}]
[INFO] JRuby limited openssl loaded. http://jruby.org/openssl
[INFO] gem install jruby-openssl for full support.
[INFO] GET http://rubygems.org/specs.4.8.gz
[INFO] 302 Found
[INFO] GET http://production.s3.rubygems.org/specs.4.8.gz
[INFO] 200 OK
[INFO] Installing gem cuke4duke-0.4.2
[INFO] /Users/aslakhellesoy/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/.gitignore
[INFO] /Users/aslakhellesoy/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cucumber/class_support/backtrace_filter.rb
[INFO] /Users/aslakhellesoy/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cucumber/class_support/class_language.rb
[INFO] /Users/aslakhellesoy/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cucumber/clj_support/backtrace_filter.rb
[INFO] /Users/aslakhellesoy/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cucumber/clj_support/clj_language.rb
[INFO] /Users/aslakhellesoy/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cucumber/groovy_support/backtrace_filter.rb
[INFO] /Users/aslakhellesoy/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cucumber/groovy_support/groovy_language.rb
[INFO] /Users/aslakhellesoy/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cucumber/ik_support/backtrace_filter.rb
[INFO] /Users/aslakhellesoy/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cucumber/ik_support/ik_language.rb
[INFO] /Users/aslakhellesoy/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cucumber/java_support/java_analyzer.rb
[INFO] /Users/aslakhellesoy/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cucumber/java_support/java_snippet_generator.rb
[INFO] /Users/aslakhellesoy/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cucumber/java_support/java_snippet_generator_spec.rb
[INFO] /Users/aslakhellesoy/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cucumber/js_support/backtrace_filter.rb
[INFO] /Users/aslakhellesoy/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cucumber/js_support/js_language.rb
[INFO] /Users/aslakhellesoy/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cucumber/jvm_support/backtrace_filter.rb
[INFO] /Users/aslakhellesoy/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cucumber/scala_support/backtrace_filter.rb
[INFO] /Users/aslakhellesoy/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cucumber/scala_support/scala_analyzer.rb
[INFO] /Users/aslakhellesoy/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cucumber/scala_support/scala_snippet_generator.rb
[INFO] /Users/aslakhellesoy/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cuke4duke.rb
[INFO] /Users/aslakhellesoy/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cuke4duke/language_proxy.rb
[INFO] /Users/aslakhellesoy/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cuke4duke/py_string_ext.rb
[INFO] /Users/aslakhellesoy/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cuke4duke/scenario_ext.rb
[INFO] /Users/aslakhellesoy/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cuke4duke/step_match_ext.rb
[INFO] /Users/aslakhellesoy/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cuke4duke/step_mother_ext.rb
[INFO] /Users/aslakhellesoy/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cuke4duke/table_ext.rb
[INFO] /Users/aslakhellesoy/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cuke4duke/version.rb
[INFO] /Users/aslakhellesoy/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cuke4duke-0.4.2.jar
[INFO] /Users/aslakhellesoy/.m2/repository/.jruby/gems/cuke4duke-0.4.2/pom.xml
[INFO] /Users/aslakhellesoy/.m2/repository/.jruby/gems/cuke4duke-0.4.2/LICENCE
[INFO] /Users/aslakhellesoy/.m2/repository/.jruby/gems/cuke4duke-0.4.2/README.textile
[INFO] /Users/aslakhellesoy/.m2/repository/.jruby/gems/cuke4duke-0.4.2/bin/cuke4duke
[INFO] /Users/aslakhellesoy/.m2/repository/.jruby/bin/cuke4duke
[INFO] Successfully installed cuke4duke-0.4.2
[INFO] 1 gem installed
[INFO] Code:
[INFO]   * /Users/aslakhellesoy/scm/cuke4duke/examples/java/src/test/ruby/ruby_hook.rb
[INFO]   * /Users/aslakhellesoy/scm/cuke4duke/examples/java/target/test-classes/simple/CalledSteps.class
mBread commented 14 years ago

The output I get is definitely different. I think this is the appropriate bit, but I've uploaded the whole thing at http://pastebin.com/LuFWQpwU

[INFO] Installing gem cuke4duke-0.4.2
[INFO] Downloading gem cuke4duke-0.4.2.gem
[INFO] GET http://rubygems.org/gems/cuke4duke-0.4.2.gem
[INFO] connection reset after 4 requests, retrying
[INFO] GET http://rubygems.org/gems/cuke4duke-0.4.2.gem
[INFO] 302 Found
[INFO] GET http://production.cf.rubygems.org/gems/cuke4duke-0.4.2.gem
[INFO] 200 OK
[INFO] /Users/mbread/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/.gitignore
[INFO] /Users/mbread/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cucumber/class_support/backtrace_filter.rb
[INFO] /Users/mbread/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cucumber/class_support/class_language.rb
[INFO] /Users/mbread/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cucumber/clj_support/backtrace_filter.rb
[INFO] /Users/mbread/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cucumber/clj_support/clj_language.rb
[INFO] /Users/mbread/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cucumber/groovy_support/backtrace_filter.rb
[INFO] /Users/mbread/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cucumber/groovy_support/groovy_language.rb
[INFO] /Users/mbread/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cucumber/ik_support/backtrace_filter.rb
[INFO] /Users/mbread/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cucumber/ik_support/ik_language.rb
[INFO] /Users/mbread/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cucumber/java_support/java_analyzer.rb
[INFO] /Users/mbread/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cucumber/java_support/java_snippet_generator.rb
[INFO] /Users/mbread/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cucumber/java_support/java_snippet_generator_spec.rb
[INFO] /Users/mbread/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cucumber/js_support/backtrace_filter.rb
[INFO] /Users/mbread/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cucumber/js_support/js_language.rb
[INFO] /Users/mbread/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cucumber/jvm_support/backtrace_filter.rb
[INFO] /Users/mbread/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cucumber/scala_support/backtrace_filter.rb
[INFO] /Users/mbread/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cucumber/scala_support/scala_analyzer.rb
[INFO] /Users/mbread/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cucumber/scala_support/scala_snippet_generator.rb
[INFO] /Users/mbread/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cuke4duke.rb
[INFO] /Users/mbread/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cuke4duke/language_proxy.rb
[INFO] /Users/mbread/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cuke4duke/py_string_ext.rb
[INFO] /Users/mbread/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cuke4duke/scenario_ext.rb
[INFO] /Users/mbread/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cuke4duke/step_match_ext.rb
[INFO] /Users/mbread/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cuke4duke/step_mother_ext.rb
[INFO] /Users/mbread/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cuke4duke/table_ext.rb
[INFO] /Users/mbread/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cuke4duke/version.rb
[INFO] /Users/mbread/.m2/repository/.jruby/gems/cuke4duke-0.4.2/lib/cuke4duke-0.4.2.jar
[INFO] /Users/mbread/.m2/repository/.jruby/gems/cuke4duke-0.4.2/pom.xml
[INFO] /Users/mbread/.m2/repository/.jruby/gems/cuke4duke-0.4.2/LICENCE
[INFO] /Users/mbread/.m2/repository/.jruby/gems/cuke4duke-0.4.2/README.textile
[INFO] /Users/mbread/.m2/repository/.jruby/gems/cuke4duke-0.4.2/bin/cuke4duke
[INFO] file:/Users/mbread/.m2/repository/org/jruby/jruby-complete/1.5.3/jruby-complete-1.5.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/installer.rb:388 warning: executable? does not in this environment and will return a dummy value
[INFO] /Users/mbread/cuke4duke/examples/java/o-user-install/cuke4duke
[INFO] Successfully installed json-1.4.6-java
[INFO] Successfully installed term-ansicolor-1.0.5
[INFO] Successfully installed gherkin-2.2.8-java
[INFO] Successfully installed builder-2.1.2
[INFO] Successfully installed diff-lcs-1.1.2
[INFO] Successfully installed cucumber-0.9.2
[INFO] Successfully installed cuke4duke-0.4.2
[INFO] 7 gems installed
[INFO] Error opening script file: /Users/mbread/.m2/repository/.jruby/bin/cuke4duke (No such file or directory)
aslakhellesoy commented 14 years ago

So for some reason rubygems does not copy the gem's executable script over from .jruby/gems/cuke4duke-0.4.2/bin/cuke4duke to .jruby/bin/cuke4duke. I have no idea why this is happening. I don't get the "executable? does not in this environment..." warning, but you do.

We'll have to ask the JRuby team about this. Until this is resolved I suggest you manually create the missing file. It should contain:

#!/usr/bin/env jruby
#
# This file was generated by RubyGems.
#
# The application 'cuke4duke' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'rubygems'

version = ">= 0"

if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
  version = $1
  ARGV.shift
end

gem 'cuke4duke', version
load Gem.bin_path('cuke4duke', 'cuke4duke', version)
mBread commented 14 years ago

I've reported a JRuby issue here: http://jira.codehaus.org/browse/JRUBY-5139

aslakhellesoy commented 14 years ago

Ok. I'm not sure that warning is the real reason for the executable being copied over. I've looked at the JRuby source, and the method always returns true. I think maybe you should register an issue that is about gem executables not being copied to the bin folder.

mBread commented 14 years ago

New JRuby issue "Gem executables not copied to bin directory under Maven": http://jira.codehaus.org/browse/JRUBY-5140

mBread commented 14 years ago

Ok, manually creating the cuke4duke script in the bin directory as you specified above does allow the examples/java example to run, with the following results (which I guess are what is expected): [INFO] 19 scenarios (1 undefined, 1 pending, 17 passed) [INFO] 50 steps (1 skipped, 1 undefined, 1 pending, 47 passed)

However, when running my own pom file there is another error: [INFO] Could not find RubyGem json_pure (>= 0) INFO [INFO] file:/Users/mbread/.m2/repository/org/jruby/jruby-complete/1.5.3/jruby-complete-1.5.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems.rb:777:in report_activate_error' [INFO] file:/Users/mbread/.m2/repository/org/jruby/jruby-complete/1.5.3/jruby-complete-1.5.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems.rb:211:inactivate' [INFO] file:/Users/mbread/.m2/repository/org/jruby/jruby-complete/1.5.3/jruby-complete-1.5.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems.rb:1056:in gem' [INFO] /Users/mbread/Desktop/quelea-cucumber/o-user-install/edit_json.rb:18 [INFO] /Users/mbread/Desktop/quelea-cucumber/o-user-install/edit_json.rb:143:inload' [INFO] /Users/mbread/.m2/repository/.jruby/gems/cucumber-0.9.2/bin/../lib/cucumber/rb_support/rb_language.rb:143:in load_code_file' [INFO] /Users/mbread/.m2/repository/.jruby/gems/cucumber-0.9.2/lib/cucumber/runtime/support_code.rb:158:inload_file' [INFO] /Users/mbread/.m2/repository/.jruby/gems/cucumber-0.9.2/lib/cucumber/runtime/support_code.rb:61:in load_files!' [INFO] /Users/mbread/.m2/repository/.jruby/gems/cucumber-0.9.2/lib/cucumber/runtime/support_code.rb:60:ineach' [INFO] /Users/mbread/.m2/repository/.jruby/gems/cucumber-0.9.2/lib/cucumber/runtime/support_code.rb:60:in load_files!' [INFO] /Users/mbread/.m2/repository/.jruby/gems/cucumber-0.9.2/lib/cucumber/runtime.rb:185:inload_step_definitions' [INFO] /Users/mbread/.m2/repository/.jruby/gems/cucumber-0.9.2/lib/cucumber/runtime.rb:26:in run!' [INFO] /Users/mbread/.m2/repository/.jruby/gems/cucumber-0.9.2/lib/cucumber/cli/main.rb:54:inexecute!' [INFO] /Users/mbread/.m2/repository/.jruby/gems/cucumber-0.9.2/lib/cucumber/cli/main.rb:29:in execute' [INFO] /Users/mbread/.m2/repository/.jruby/gems/cucumber-0.9.2/bin/cucumber:8 [INFO] /Users/mbread/.m2/repository/.jruby/gems/cucumber-0.9.2/bin/cucumber:4:inload' [INFO] /Users/mbread/.m2/repository/.jruby/gems/cuke4duke-0.4.2/bin/cuke4duke:4 [INFO] /Users/mbread/.m2/repository/.jruby/gems/cuke4duke-0.4.2/bin/cuke4duke:19:in `load' [INFO] /Users/mbread/.m2/repository/.jruby/bin/cuke4duke:19

POM file is here: http://pastebin.com/p45Mr7K4

aslakhellesoy commented 14 years ago

Now it looks like you have another problem. What's in your edit_json.rb file, and why do you have this file in the first place?

mBread commented 14 years ago

I'm not sure where that file came from. I deleted the o-user-install directory & it's working now. Thanks!

aslakhellesoy commented 14 years ago

OK, I'm closing this ticket then - hopefully http://jira.codehaus.org/browse/JRUBY-5140 will solve this in the future.

alexschwartz commented 13 years ago

I am running in the same problem.

Is there a manual fix? Just creating the link ln -s /Users/aleschwa/.m2/repository/.jruby/gems/cuke4duke-0.4.3/bin/cuke4duke /Users/aleschwa/.m2/repository/.jruby/bin/cuke4duke yields to the error [INFO] [jar:jar {execution: default-jar}] [INFO] [cuke4duke:cucumber {execution: run-features}] [INFO] /Users/aleschwa/.m2/repository/.jruby/bin/cuke4duke:3:in `require': no such file to load -- cuke4duke (LoadError) [INFO] from /Users/aleschwa/.m2/repository/.jruby/bin/cuke4duke:3 [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] JRuby failed.

Any hints? --Alex

DuWeiZhong commented 12 years ago

The same problem is happened in here. I also create a link like alex. [INFO] --- cuke4duke-maven-plugin:0.4.4:cucumber (run-features) @ cuke4duke-java-example --- [INFO] LoadError: no such file to load -- cuke4duke [INFO] require at org/jruby/RubyKernel.java:1038 INFO at /home/ac/.m2/repository/.jruby/bin/cuke4duke:3 [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3.687s [INFO] Finished at: Tue Jan 31 15:43:03 CST 2012 [INFO] Final Memory: 10M/104M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal cuke4duke:cuke4duke-maven-plugin:0.4.4:cucumber (run-features) on project cuke4duke-java-example: JRuby failed. Java returned: 1 -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR]

--Du