tomcat7-maven-plugin extraDependency not working with class not found
---------------------------------------------------------------------
Key: MTOMCAT-106
URL: https://issues.apache.org/jira/browse/MTOMCAT-106
Project: Apache Tomcat Maven Plugin
Issue Type: Bug
Components: tomcat7
Affects Versions: 2.0
Environment: Ubuntu 11.04 @32bit with Maven 2.2.1 and Java 1.6.0_26
Reporter: William Ghelfi
Assignee: Olivier Lamy
Hello,
I'm trying to use the 'exec-war-only' goal from version 2.0-SNAPSHOT of
tomcat7-maven-plugin, taken from
http://people.apache.org/repo/m2-snapshot-repository
Needing derby, I would use the extraDependencies configuration element as
showed in the second example at:
http://tomcat.apache.org/maven-plugin-2.0-SNAPSHOT/executable-war-jar.html
Here's my configuration:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.0-SNAPSHOT</version>
<executions>
<execution>
<id>tomcat-run</id>
<goals>
<goal>exec-war-only</goal>
</goals>
<phase>package</phase>
<configuration>
<path>/${project.artifactId}</path>
<enableNaming>true</enableNaming>
<extraDependencies>
<extraDependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.8.2.2</version>
</extraDependency>
</extraDependencies>
</configuration>
</execution>
</executions>
</plugin>
So I launch "mvn clean package -e" and get:
org.apache.maven.lifecycle.LifecycleExecutionException: Error configuring:
org.apache.tomcat.maven:tomcat7-maven-plugin. Reason: Unable to parse the
created DOM for plugin configuration
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:723)
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: org.apache.maven.plugin.PluginConfigurationException: Error
configuring: org.apache.tomcat.maven:tomcat7-maven-plugin. Reason: Unable to
parse the created DOM for plugin configuration
at
org.apache.maven.plugin.DefaultPluginManager.populatePluginFields(DefaultPluginManager.java:1363)
at
org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo(DefaultPluginManager.java:724)
at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:468)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
... 17 more
Caused by:
org.codehaus.plexus.component.configurator.ComponentConfigurationException:
Error loading class 'org.apache.tomcat.maven.plugin.tomcat7.run.ExtraDependency'
at
org.codehaus.plexus.component.configurator.converters.composite.CollectionConverter.fromConfiguration(CollectionConverter.java:170)
at
org.codehaus.plexus.component.configurator.converters.ComponentValueSetter.configure(ComponentValueSetter.java:247)
at
org.codehaus.plexus.component.configurator.converters.composite.ObjectWithFieldsConverter.processConfiguration(ObjectWithFieldsConverter.java:137)
at
org.codehaus.plexus.component.configurator.BasicComponentConfigurator.configureComponent(BasicComponentConfigurator.java:56)
at
org.apache.maven.plugin.DefaultPluginManager.populatePluginFields(DefaultPluginManager.java:1357)
... 20 more
Caused by: java.lang.ClassNotFoundException:
org.apache.tomcat.maven.plugin.tomcat7.run.ExtraDependency
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:306)
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:247)
at
org.codehaus.plexus.component.configurator.converters.composite.CollectionConverter.fromConfiguration(CollectionConverter.java:158)
... 24 more
Then I tried to get sources and build myself a plugin
newer-than-the-latest-snapshot, but it failed on execution just as the snapshot
So, I forked the mirror you have on github and hacked a patch that just works
for me and follows the syntax found for another similar snippet
(<warRunDependencies>)
This is because I'm a power linux user and mid-level web designer, rather than
a Java programmer, so I didn't manage to follow a different way to get it work
:)
Here is the pull request with the patch:
https://github.com/apache/tomcat-maven-plugin/pull/1/files
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]