Steps class can't depend on a library with <scope>test</scope> in pom.xml

Description

In my Steps implementation, I use an external library. In my pom.xml, this is dependency is declared with <scope>test</scope>. jBehave maven plugin is not able to find this library. Please run the attached project as:

$ mvn clean integration-test -Dlib.scope=compile
...
[INFO] Running scenario binil.scenarios.MyScenario
...
[INFO] BUILD SUCCESSFUL
...

$ mvn clean integration-test -Dlib.scope=test
...
[INFO] [jbehave:run-scenarios {execution: run-scenarios-listed}]
[INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------ [INFO] Failed to instantiate scenario 'binil.scenarios.MyScenario'

Embedded error: The scenario 'binil.scenarios.MyScenario' could not be instantiated with class loader: [org.jbehave.scenario.ScenarioClassLoader urls=/Users/binil/work/jbehave-bug-report/target/test-classes/, /Users/binil/work/jbehave-bug-report/target/classes]
org/apache/log4j/Logger
...
$

This forces me to declare the dependency (in my specific case, jetty and dbunit) as <scope>compile</scope> in my pom.xml, which means all users of my project needs to get this library as a transitive dependency. I would like to avoid that.

Assignee

Mauro Talevi

Reporter

Binil Thomas

Labels

None

Components

Affects versions

Priority

Major
Configure