OK,

I'll answer my own question. Apparently, the .classpath file was not correct.

It was:

<classpathentry kind="con" 
path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>

It should have been:

                <classpathentry kind="con" 
path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">
                                <attributes>
                                                <attribute 
name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
                                </attributes>
                </classpathentry>

Unfortunately, there's a few other problems. Looks like converting existing 
Eclipse-style webapps to m2eclipse is not a good idea.

From: Spies, Brennan
Sent: Wednesday, February 11, 2009 2:51 PM
To: '[email protected]'
Subject: Running web apps with m2eclipse

All,

I've got a question about using dependency management when running Tomcat 
through the Eclipse launcher and using dependency management courtesy of 
m2eclipse. I have two older projects that I converted to use Maven/m2eclipse, 
and both are webapps. I kept the same general folder structure that Eclipse 
gives you when you create a Dynamic Web app in Eclipse, and I've simply 
adjusted the pom.xml to refer to the appropriate source (src) and 
output(WebContent/WEB-INF/classes) folders.

When I run these apps on Tomcat through the Eclipse launcher, one works (i.e. 
successfully publishes jars to WEB-INF/lib) and the other one doesn't 
(java.lang.NoClassDefFoundError: org/apache/log4j/Logger).

I can see the publish/export dependency in the classpath container for both 
projects. In the .metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps 
folder I can see the jars for the two workspace-resolved projects, but none of 
the other declared dependencies.

This is probably not an m2eclipse-specific problem (I can see the same issue 
with IvyDE), but I was just wondering if anyone has seen this issue before.

Reply via email to