Hi Binil,
Binil Thomas wrote:
Hi all,
On http://jbehave.org/software/plugins/maven/ page, there is this snippet:
The configuration of the plugin would look something like:
where the include/exclude patterns are intended relative to the
classpath.
Note that jBehave does not mandate any particular structure. The
only requirement is that only classes that extend the jBehave
org.jbehave.scenario.Scenario class are included.
I am trying to create a Maven project to follow Ryan Greenhall's
tutorial (BTW, why is this tutorial not linked on the project page?).
It is: look in http://jbehave.org/documentation/resources
Right now, I have a scenario with all steps pending. I got this to run
from within my IDE (Eclipse), but I would like to run it from Maven too.
JBehave's maven plugin seems to have elaborate configuration options.
Also, the example projects at
https://svn.codehaus.org/jbehave/trunk/examples/ are not easy to follow
because it, with a scenario subproject to run JBehave etc, looks
different from typical maven projects.
I tried to configure the plugin with a blind stab, hoping for some
intelligents defaults to help me out:
<plugin>
<groupId>org.jbehave</groupId>
<artifactId>jbehave-maven-plugin</artifactId>
<version>2.0.1</version>
<executions>
<execution>
<id>run-scenarios-found</id>
<phase>integration-test</phase>
<goals>
<goal>run-scenarios</goal>
</goals>
</execution>
</executions>
</plugin>
When my scenario class is in src/main/java, jbehave complains :
[INFO] [compiler:compile]
[INFO] Compiling 1 source file to
/Users/binil/temp/jbehave-try/target/classes
...
[INFO] Failed to instantiate scenarios [binil.HeyHeyMyMy]
Embedded error: The Scenario 'binil.HeyHeyMyMy' could not be
instantiated with classpath elements:
[/Users/binil/temp/jbehave-try/target/classes/,
jbehave-core-2.0.1.jar, junit-4.4.jar]
binil.HeyHeyMyMy.<init>(java.lang.ClassLoader)
When I move my scenario class to src/test/java, I get a:
[INFO] [jbehave:run-scenarios {execution: run-scenarios-found}]
[INFO] No scenarios to run.
message.
(In both cases the hey_hey_my_my text file is at src/main/resources).
Please let me know how I should go about configuring the plugin.
You seem to have found the solution yourself - but to re-iterate:
Maven 2 is very fussy about classloaders (most probably a reaction to
Maven 1 slack in this respect :-). So each scenario needs a Classloader
to be injected. This is in general no bad practice - one can always
provide as default the thread context classloades.
I'll make sure this is documented better. Created issue to track this
http://jira.codehaus.org/browse/JBEHAVE-143
Thanks for your feedback and don't hesitate to give us a shout if you
run into problems.
Remember that, if you do, the JBehave examples are your friends:
https://svn.codehaus.org/jbehave/trunk/examples/
Cheers
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email