Document how to configure jbehave-maven-plugin to be aware of log4j dependency

Description

If my pom.xml contains a dependency on log4j then when I run the target mvn integration-test I get a stack trace indicating that the jbehave-maven-plugin can't find the log4j classes. I've attached a trivial maven project that reproduces the issue. I do not see this issue when I run the tests in eclipse as junit tests and the tests run fine if I remove log4j.

The following is the complete stack trace:

java.lang.NoClassDefFoundError: org/apache/log4j/Priority
at freemarker.log.Log4JLoggerFactory.getLogger(Log4JLoggerFactory.java:65)
at freemarker.log.Logger.getLogger(Logger.java:255)
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:132)
at freemarker.template.Configuration.<init>(Configuration.java:109)
at freemarker.template.Configuration.<clinit>(Configuration.java:96)
at org.jbehave.core.reporters.FreemarkerViewGenerator.configure(FreemarkerViewGenerator.java:208)
at org.jbehave.core.reporters.FreemarkerViewGenerator.<init>(FreemarkerViewGenerator.java:60)
at org.jbehave.core.configuration.Configuration.<init>(Configuration.java:159)
at org.jbehave.core.configuration.MostUsefulConfiguration.<init>(MostUsefulConfiguration.java:49)
at org.jbehave.core.embedder.Embedder.<init>(Embedder.java:30)
at org.jbehave.core.embedder.Embedder.<init>(Embedder.java:37)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at org.jbehave.core.embedder.EmbedderClassLoader.newInstance(EmbedderClassLoader.java:37)
at org.jbehave.mojo.AbstractEmbedderMojo.newEmbedder(AbstractEmbedderMojo.java:228)
at org.jbehave.mojo.RunStoriesAsEmbeddables.execute(RunStoriesAsEmbeddables.java:15)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
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.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Priority
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassLoader.java:195)
at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:255)
at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:274)
at org.codehaus.classworlds.RealmClassLoader.loadClass(RealmClassLoader.java:214)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 42 more

Assignee

Unassigned

Reporter

Jonathan Choate

Labels

None

Components

Fix versions

Affects versions

Priority

Major
Configure