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

Using external jar in Java step definitions (lauching cuke4duke through maven) #82

Closed mBread closed 14 years ago

mBread commented 14 years ago

I'm using cuke4duke in maven, and am trying to include an external Java library to use in my Java step definitions. The --require parameter doesn't seem to be working, and trying to use the -cp argument in the jvm args element of the Maven POM file is rejected as not recognised. Any ideas what I can do?

When trying to use the --require parameter:

${basedir}/src/test/java --require ${basedir}/lib/abbot.jar --require target/test-classes

I get a ClassNotFoundException: [INFO] --- cuke4duke-maven-plugin:0.4.2:cucumber (run-features) @ quelea-cucumber --- [INFO] java.lang.NoClassDefFoundError: junit/extensions/abbot/ComponentTestFixture (NativeException)

Trying to add it in as a jvmArg:

-Dcuke4duke.objectFactory=cuke4duke.internal.jvmclass.PicoFactory -cp ${basedir}/lib/abbot.jar

isn't recognised: [INFO] --- cuke4duke-maven-plugin:0.4.2:cucumber (run-features) @ quelea-cucumber --- [INFO] Unrecognized option: -cp /Users/mbread/Desktop/quelea-cucumber/lib/abbot.jar [INFO] Could not create the Java virtual machine.

How do I load this jar so it can be used from my step definitions?

Thanks

aslakhellesoy commented 14 years ago

Just use a regular pom

mBread commented 14 years ago

Thanks, got it sorted now. Can close the issue now.

For future reference, if anyone else needs it, I used the systemPath element & the 'system' scope, as described here: http://maven.apache.org/ref/3.0/maven-model/maven.html#class_dependency