I have a Maven project that produces a Mule Connector. It's basically a shell, so I started adding some BDD tests using JBehave. The first test I added does very little:
public class FakeSteps extends Embedder {
@Given("I have something")
public void iHaveSomething() {
System.out.println("Have something...");
}
@When("I do something")
public void iDoSomething() {
System.out.println("Doing something...");
}
@Then("we are ok")
public void weAreOk() {
Assert.assertTrue("FAILURE!!!!!", true);
System.out.println("We are ok.");
}
}
If I run the test in IntelliJ it passes. When I perform a "mvn clean install", the test does not throw an error but the build fails due to an exception in "org.apache.log4j.Priority":
...
Have something...
Doing something...
We are ok.
(AfterStories)
[INFO] Generating reports view to '/Users/user/git_repos/myTest-connector/target/jbehave' using formats '[xml, ide_console, console, html, txt]' and view properties '{defaultFormats=stats, decorateNonHtml=true, viewDirectory=view, decorated=ftl/jbehave-report-decorated.ftl, reports=ftl/jbehave-reports-with-totals.ftl, maps=ftl/jbehave-maps.ftl, navigator=ftl/jbehave-navigator.ftl, views=ftl/jbehave-views.ftl, nonDecorated=ftl/jbehave-report-non-decorated.ftl}'
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 53.650s
[INFO] Finished at: Thu Sep 26 17:38:36 MDT 2013
[INFO] Final Memory: 38M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jbehave:jbehave-maven-plugin:3.8:run-stories-as-embeddables (run-stories-as-embeddables) on project myTest-connector: Failed to run stories as embeddables: Failure in running embeddable: org.mule.modules.jbehave.JBehaveStories: org/apache/log4j/Priority: org.apache.log4j.Priority -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.jbehave:jbehave-maven-plugin:3.8:run-stories-as-embeddables (run-stories-as-embeddables) on project myTest-connector: Failed to run stories as embeddables
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoFailureException: Failed to run stories as embeddables
at org.jbehave.mojo.RunStoriesAsEmbeddables.execute(RunStoriesAsEmbeddables.java:20)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: org.jbehave.core.embedder.Embedder$RunningEmbeddablesFailed: Failure in running embeddable: org.mule.modules.jbehave.JBehaveStories
at org.jbehave.core.embedder.Embedder.runAsEmbeddables(Embedder.java:131)
at org.jbehave.mojo.RunStoriesAsEmbeddables.execute(RunStoriesAsEmbeddables.java:18)
... 21 more
Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Priority
at freemarker.log.Log4JLoggerFactory.getLogger(Log4JLoggerFactory.java:65)
at freemarker.log.Logger.getLogger(Logger.java:284)
at freemarker.template.utility.SecurityUtilities.<clinit>(SecurityUtilities.java:67)
at freemarker.ext.beans.BeansWrapper.<clinit>(BeansWrapper.java:147)
at freemarker.template.ObjectWrapper.<clinit>(ObjectWrapper.java:69)
at freemarker.core.Configurable.<init>(Configurable.java:139)
at freemarker.template.Configuration.<init>(Configuration.java:142)
at freemarker.template.Configuration.<clinit>(Configuration.java:127)
at org.jbehave.core.reporters.FreemarkerProcessor.configuration(FreemarkerProcessor.java:30)
at org.jbehave.core.reporters.FreemarkerProcessor.process(FreemarkerProcessor.java:21)
at org.jbehave.core.reporters.TemplateableViewGenerator.write(TemplateableViewGenerator.java:237)
at org.jbehave.core.reporters.TemplateableViewGenerator.createReports(TemplateableViewGenerator.java:189)
at org.jbehave.core.reporters.TemplateableViewGenerator.generateReportsView(TemplateableViewGenerator.java:111)
at org.jbehave.core.embedder.Embedder.generateReportsView(Embedder.java:245)
at org.jbehave.core.embedder.Embedder.generateReportsView(Embedder.java:233)
at org.jbehave.core.embedder.Embedder.runStoriesAsPaths(Embedder.java:212)
at org.jbehave.core.junit.JUnitStories.run(JUnitStories.java:20)
at org.jbehave.core.embedder.Embedder.runAsEmbeddables(Embedder.java:122)
... 22 more
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Priority
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
... 40 more
[ERROR]
[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/MojoFailureException
My Maven config for JBehave is:
<properties>
<mule.version>3.4.0</mule.version>
<mule.devkit.version>3.4.0</mule.devkit.version>
<junit.version>4.11</junit.version>
<mockito.version>1.8.2</mockito.version>
<jdk.version>1.6</jdk.version>
<jbehave.version>3.8</jbehave.version>
</properties>
...
<plugin>
<groupId>org.jbehave</groupId>
<artifactId>jbehave-maven-plugin</artifactId>
<version>${jbehave.version}</version>
<executions>
<execution>
<id>run-stories-as-embeddables</id>
<phase>integration-test</phase>
<configuration>
<scope>test</scope>
<includes>
<include>**/*Stories.java</include>
</includes>
<ignoreFailureInStories>false</ignoreFailureInStories>
<ignoreFailureInView>false</ignoreFailureInView>
</configuration>
<goals>
<goal>run-stories-as-embeddables</goal>
</goals>
</execution>
</executions>
</plugin>
My Maven, Java, and machine information is:
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 06:51:28-0700)
Maven home: /usr/share/maven
Java version: 1.6.0_51, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: en_US, platform encoding: UTF8
OS name: "mac os x", version: "10.8.5", arch: "x86_64", family: "mac"
It's unclear to me what the root cause is. I added log4j as a Maven dependency and the problem continues.
Here is the maven dependency tree:
[INFO] ------------------------------------------------------------------------
[INFO] Building Mule Cloud Connector 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ myTest-connector ---
[INFO] org.mule.modules:myTest-connector:mule-module:1.0-SNAPSHOT
[INFO] +- org.mule:mule-core:jar:3.4.0:provided (scope not updated to compile)
[INFO] | +- commons-beanutils:commons-beanutils:jar:1.8.0:provided
[INFO] | +- org.safehaus.jug:jug:jar:asl:2.0.0:provided
[INFO] | +- commons-cli:commons-cli:jar:1.2:provided
[INFO] | +- (commons-collections:commons-collections:jar:3.2.1:compile - scope updated from provided; omitted for duplicate)
[INFO] | +- (commons-io:commons-io:jar:1.4:compile - scope updated from provided; omitted for duplicate)
[INFO] | +- (commons-lang:commons-lang:jar:2.4:compile - scope updated from provided; omitted for duplicate)
[INFO] | +- commons-pool:commons-pool:jar:1.5.3:provided
[INFO] | +- javax.activation:activation:jar:1.1-osgi:provided
[INFO] | +- org.apache.geronimo.specs:geronimo-jta_1.1_spec:jar:1.1.1:provided
[INFO] | +- org.apache.geronimo.specs:geronimo-j2ee-connector_1.5_spec:jar:1.1-osgi:provided
[INFO] | +- javax.annotation:jsr250-api:jar:1.0:provided
[INFO] | +- org.slf4j:jcl-over-slf4j:jar:1.6.1:provided
[INFO] | | \- (org.slf4j:slf4j-api:jar:1.6.1:provided - omitted for duplicate)
[INFO] | +- (org.slf4j:slf4j-api:jar:1.6.1:compile - scope updated from provided; omitted for duplicate)
[INFO] | +- org.slf4j:slf4j-log4j12:jar:1.6.1:provided
[INFO] | | +- (org.slf4j:slf4j-api:jar:1.6.1:provided - omitted for duplicate)
[INFO] | | \- (log4j:log4j:jar:1.2.16:provided - omitted for duplicate)
[INFO] | +- log4j:log4j:jar:1.2.16:provided
[INFO] | +- asm:asm:jar:3.1:provided
[INFO] | +- asm:asm-commons:jar:3.1:provided
[INFO] | | \- asm:asm-tree:jar:3.1:provided
[INFO] | | \- (asm:asm:jar:3.1:provided - omitted for duplicate)
[INFO] | +- org.mvel:mvel2:jar:2.1.3.Final:provided
[INFO] | +- org.jgrapht:jgrapht-jdk1.5:jar:0.7.3:provided
[INFO] | \- org.mule.common:mule-common:jar:0.11.0:provided
[INFO] +- org.mule.modules:mule-module-spring-config:jar:3.4.0:compile
[INFO] | +- (org.mule:mule-core:jar:3.4.0:compile - omitted for duplicate)
[INFO] | +- org.mule.modules:mule-module-annotations:jar:3.4.0:compile
[INFO] | | +- (org.mule:mule-core:jar:3.4.0:compile - omitted for duplicate)
[INFO] | | \- cglib:cglib-nodep:jar:2.2:compile
[INFO] | +- org.springframework:spring-context:jar:3.2.1.RELEASE:compile
[INFO] | | +- org.springframework:spring-beans:jar:3.2.1.RELEASE:compile
[INFO] | | | \- (org.springframework:spring-core:jar:3.2.1.RELEASE:compile - omitted for duplicate)
[INFO] | | +- org.springframework:spring-aop:jar:3.2.1.RELEASE:compile
[INFO] | | | +- (org.springframework:spring-beans:jar:3.2.1.RELEASE:compile - omitted for duplicate)
[INFO] | | | \- (org.springframework:spring-core:jar:3.2.1.RELEASE:compile - omitted for duplicate)
[INFO] | | +- org.springframework:spring-expression:jar:3.2.1.RELEASE:compile
[INFO] | | | \- (org.springframework:spring-core:jar:3.2.1.RELEASE:compile - omitted for duplicate)
[INFO] | | \- org.springframework:spring-core:jar:3.2.1.RELEASE:compile
[INFO] | +- dom4j:dom4j:jar:1.6.1-osgi:compile
[INFO] | \- jaxen:jaxen:jar:1.1.1:compile
[INFO] | +- (dom4j:dom4j:jar:1.6.1:compile - omitted for conflict with 1.6.1-osgi)
[INFO] | +- (jaxen:jaxen:jar:1.0-FCS:compile - omitted for cycle)
[INFO] | \- jdom:jdom:jar:1.0:compile
[INFO] +- org.mule.tools.devkit:mule-devkit-annotations:jar:3.4.0:compile
[INFO] | +- javax.inject:javax.inject:jar:1:compile
[INFO] | +- (org.mule.modules:mule-module-annotations:jar:3.4.0:compile - omitted for duplicate)
[INFO] | \- org.mule.modules:mule-module-devkit-support:jar:3.4.0:compile
[INFO] | \- (org.mule:mule-core:jar:3.4.0:compile - omitted for duplicate)
[INFO] +- org.eclipse:eclipse-workbench:jar:3.6.1.M20100826-1330:provided
[INFO] +- org.eclipse:eclipse-runtime:jar:3.6.0.v20100505:provided
[INFO] +- org.osgi:core:jar:4.3.0:provided
[INFO] +- org.mockito:mockito-all:jar:1.8.2:test
[INFO] +- org.mule.tests:mule-tests-functional:jar:3.4.0:test
[INFO] | +- (org.mule:mule-core:jar:3.4.0:test - omitted for duplicate)
[INFO] | +- (org.mule.modules:mule-module-spring-config:jar:3.4.0:test - omitted for duplicate)
[INFO] | +- (org.springframework:spring-beans:jar:3.2.1.RELEASE:compile - scope updated from test; omitted for duplicate)
[INFO] | +- (junit:junit:jar:4.9:compile - scope updated from test; omitted for duplicate)
[INFO] | +- commons-net:commons-net:jar:2.0:test
[INFO] | +- org.apache.ftpserver:ftpserver-core:jar:1.0.2:test
[INFO] | | +- (org.apache.ftpserver:ftplet-api:jar:1.0.2:test - omitted for duplicate)
[INFO] | | +- (org.slf4j:slf4j-api:jar:1.5.2:test - omitted for conflict with 1.6.1)
[INFO] | | \- org.apache.mina:mina-core:jar:2.0.0-M6:test
[INFO] | | \- (org.slf4j:slf4j-api:jar:1.5.2:test - omitted for conflict with 1.6.1)
[INFO] | +- org.apache.ftpserver:ftplet-api:jar:1.0.2:test
[INFO] | +- org.apache.sshd:sshd-core:jar:0.6.0:test
[INFO] | | \- (org.apache.mina:mina-core:jar:2.0.2:test - omitted for conflict with 2.0.0-M6)
[INFO] | +- bouncycastle:bcprov-jdk14:jar:139:test
[INFO] | +- org.mule:mule-core:test-jar:tests:3.4.0:test
[INFO] | | +- (commons-beanutils:commons-beanutils:jar:1.8.0:test - omitted for duplicate)
[INFO] | | +- (org.safehaus.jug:jug:jar:asl:2.0.0:test - omitted for duplicate)
[INFO] | | +- (commons-cli:commons-cli:jar:1.2:test - omitted for duplicate)
[INFO] | | +- (commons-collections:commons-collections:jar:3.2.1:test - omitted for duplicate)
[INFO] | | +- (commons-io:commons-io:jar:1.4:test - omitted for duplicate)
[INFO] | | +- (commons-lang:commons-lang:jar:2.4:test - omitted for duplicate)
[INFO] | | +- (commons-pool:commons-pool:jar:1.5.3:test - omitted for duplicate)
[INFO] | | +- (javax.activation:activation:jar:1.1-osgi:test - omitted for duplicate)
[INFO] | | +- (org.apache.geronimo.specs:geronimo-jta_1.1_spec:jar:1.1.1:test - omitted for duplicate)
[INFO] | | +- (org.apache.geronimo.specs:geronimo-j2ee-connector_1.5_spec:jar:1.1-osgi:test - omitted for duplicate)
[INFO] | | +- (javax.annotation:jsr250-api:jar:1.0:test - omitted for duplicate)
[INFO] | | +- (org.slf4j:jcl-over-slf4j:jar:1.6.1:test - omitted for duplicate)
[INFO] | | +- (org.slf4j:slf4j-api:jar:1.6.1:test - omitted for duplicate)
[INFO] | | +- (org.slf4j:slf4j-log4j12:jar:1.6.1:test - omitted for duplicate)
[INFO] | | +- (log4j:log4j:jar:1.2.16:test - omitted for duplicate)
[INFO] | | +- (asm:asm:jar:3.1:test - omitted for duplicate)
[INFO] | | +- (asm:asm-commons:jar:3.1:test - omitted for duplicate)
[INFO] | | +- (org.mvel:mvel2:jar:2.1.3.Final:test - omitted for duplicate)
[INFO] | | +- (org.jgrapht:jgrapht-jdk1.5:jar:0.7.3:test - omitted for duplicate)
[INFO] | | \- (org.mule.common:mule-common:jar:0.11.0:test - omitted for duplicate)
[INFO] | \- (org.mockito:mockito-all:jar:1.9.0:test - omitted for conflict with 1.8.2)
[INFO] +- com.amazonaws:aws-java-sdk:jar:1.5.6:compile
[INFO] | +- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] | +- org.apache.httpcomponents:httpclient:jar:4.2:compile
[INFO] | | +- org.apache.httpcomponents:httpcore:jar:4.2:compile
[INFO] | | +- (commons-logging:commons-logging:jar:1.1.1:compile - omitted for duplicate)
[INFO] | | \- (commons-codec:commons-codec:jar:1.6:compile - omitted for conflict with 1.3)
[INFO] | +- commons-codec:commons-codec:jar:1.3:compile
[INFO] | +- org.codehaus.jackson:jackson-core-asl:jar:1.8.9:compile
[INFO] | \- org.codehaus.jackson:jackson-mapper-asl:jar:1.8.9:compile
[INFO] | \- (org.codehaus.jackson:jackson-core-asl:jar:1.8.9:compile - omitted for duplicate)
[INFO] +- ch.qos.logback:logback-classic:jar:1.0.13:compile
[INFO] | +- ch.qos.logback:logback-core:jar:1.0.13:compile
[INFO] | \- org.slf4j:slf4j-api:jar:1.6.1:compile
[INFO] +- uk.com.robust-it:cloning:jar:1.9.0:compile
[INFO] | \- org.objenesis:objenesis:jar:1.2:compile
[INFO] +- org.jbehave:jbehave-core:jar:3.8:compile
[INFO] | +- junit:junit-dep:jar:4.8.2:compile
[INFO] | +- org.hamcrest:hamcrest-core:jar:1.1:compile
[INFO] | +- org.hamcrest:hamcrest-library:jar:1.1:compile
[INFO] | | \- (org.hamcrest:hamcrest-core:jar:1.1:compile - omitted for duplicate)
[INFO] | +- org.hamcrest:hamcrest-integration:jar:1.1:compile
[INFO] | | \- (org.hamcrest:hamcrest-core:jar:1.1:compile - omitted for duplicate)
[INFO] | +- commons-collections:commons-collections:jar:3.2.1:compile
[INFO] | +- commons-io:commons-io:jar:1.4:compile
[INFO] | +- commons-lang:commons-lang:jar:2.4:compile
[INFO] | +- org.codehaus.plexus:plexus-utils:jar:3.0.10:compile
[INFO] | +- org.freemarker:freemarker:jar:2.3.19:compile
[INFO] | +- com.thoughtworks.paranamer:paranamer:jar:2.4:compile
[INFO] | \- com.thoughtworks.xstream:xstream:jar:1.4.4:compile
[INFO] | +- xmlpull:xmlpull:jar:1.1.3.1:compile
[INFO] | \- xpp3:xpp3_min:jar:1.1.4c:compile
[INFO] +- org.jbehave:jbehave-maven-plugin:jar:3.8:compile
[INFO] | +- (org.jbehave:jbehave-core:jar:3.8:compile - omitted for duplicate)
[INFO] | +- org.apache.maven:maven-plugin-api:jar:2.0.11:compile
[INFO] | +- org.apache.maven:maven-artifact:jar:2.0.11:compile
[INFO] | | \- (org.codehaus.plexus:plexus-utils:jar:1.5.6:compile - omitted for conflict with 3.0.10)
[INFO] | +- org.apache.maven:maven-project:jar:2.0.11:compile
[INFO] | | +- org.apache.maven:maven-settings:jar:2.0.11:compile
[INFO] | | | +- (org.apache.maven:maven-model:jar:2.0.11:compile - omitted for duplicate)
[INFO] | | | +- (org.codehaus.plexus:plexus-interpolation:jar:1.1:compile - omitted for duplicate)
[INFO] | | | +- (org.codehaus.plexus:plexus-utils:jar:1.5.6:compile - omitted for conflict with 3.0.10)
[INFO] | | | \- (org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile - omitted for duplicate)
[INFO] | | +- org.apache.maven:maven-profile:jar:2.0.11:compile
[INFO] | | | +- (org.apache.maven:maven-model:jar:2.0.11:compile - omitted for duplicate)
[INFO] | | | +- (org.codehaus.plexus:plexus-utils:jar:1.5.6:compile - omitted for conflict with 3.0.10)
[INFO] | | | \- (org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile - omitted for duplicate)
[INFO] | | +- org.apache.maven:maven-model:jar:2.0.11:compile
[INFO] | | | \- (org.codehaus.plexus:plexus-utils:jar:1.5.6:compile - omitted for conflict with 3.0.10)
[INFO] | | +- org.apache.maven:maven-artifact-manager:jar:2.0.11:compile
[INFO] | | | +- org.apache.maven:maven-repository-metadata:jar:2.0.11:compile
[INFO] | | | | \- (org.codehaus.plexus:plexus-utils:jar:1.5.6:compile - omitted for conflict with 3.0.10)
[INFO] | | | +- (org.codehaus.plexus:plexus-utils:jar:1.5.6:compile - omitted for conflict with 3.0.10)
[INFO] | | | +- (org.apache.maven:maven-artifact:jar:2.0.11:compile - omitted for duplicate)
[INFO] | | | +- (org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile - omitted for duplicate)
[INFO] | | | \- org.apache.maven.wagon:wagon-provider-api:jar:1.0-beta-2:compile
[INFO] | | | \- (org.codehaus.plexus:plexus-utils:jar:1.0.4:compile - omitted for conflict with 3.0.10)
[INFO] | | +- org.apache.maven:maven-plugin-registry:jar:2.0.11:compile
[INFO] | | | +- (org.codehaus.plexus:plexus-utils:jar:1.5.6:compile - omitted for conflict with 3.0.10)
[INFO] | | | \- (org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile - omitted for duplicate)
[INFO] | | +- org.codehaus.plexus:plexus-interpolation:jar:1.1:compile
[INFO] | | +- (org.codehaus.plexus:plexus-utils:jar:1.5.6:compile - omitted for conflict with 3.0.10)
[INFO] | | +- (org.apache.maven:maven-artifact:jar:2.0.11:compile - omitted for duplicate)
[INFO] | | \- org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile
[INFO] | | +- (junit:junit:jar:3.8.1:compile - omitted for conflict with 4.10)
[INFO] | | +- (org.codehaus.plexus:plexus-utils:jar:1.0.4:compile - omitted for conflict with 3.0.10)
[INFO] | | \- classworlds:classworlds:jar:1.1-alpha-2:compile
[INFO] | \- org.codehaus.plexus:plexus-archiver:jar:1.2:compile
[INFO] | +- (org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile - omitted for duplicate)
[INFO] | +- (org.codehaus.plexus:plexus-utils:jar:2.0.5:compile - omitted for conflict with 3.0.10)
[INFO] | \- org.codehaus.plexus:plexus-io:jar:1.0.1:compile
[INFO] | \- (org.codehaus.plexus:plexus-utils:jar:2.0.5:compile - omitted for conflict with 3.0.10)
[INFO] \- de.codecentric:jbehave-junit-runner:jar:1.0.1:compile
[INFO] +- junit:junit:jar:4.10:compile
[INFO] | \- (org.hamcrest:hamcrest-core:jar:1.1:compile - omitted for duplicate)
[INFO] \- org.mockito:mockito-core:jar:1.9.0:compile
[INFO] +- (org.hamcrest:hamcrest-core:jar:1.1:compile - omitted for duplicate)
[INFO] \- (org.objenesis:objenesis:jar:1.0:compile - omitted for conflict with 1.2)
Any thoughts on what the root problem is or how to fix it?
--- Update ---
As per the conversation below I added the dependency to log4j in my JBehave plugin, and the problem was fixed:
<plugin>
<groupId>org.jbehave</groupId>
<artifactId>jbehave-maven-plugin</artifactId>
<version>${jbehave.version}</version>
<executions>
<execution>...</execution>
</executions>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<scope>compile</scope>
</dependency>
</dependencies>
</plugin>
I think one of you dependencies implicitly uses previous version of log4j which does not include org.apache.log4j.Priority. Run
mvn dependency:tree -Dverbose
to see the dependency tree and then exclude old log4j version.Update: According to the given tree, your log4j dependency has a provided scope:
log4j:log4j:jar:1.2.16:provided
, which means it won't be included into classpath during maven test phase. You may want to explicitly mention log4j artifact in your pom with the test scope.According to author comments, explicit log4j plugin dependency has fixed the problem.