views:

1014

answers:

1

Hi,

I use Eclipse J2EE 3.5 with Maven and tomcat. To deploy my maven webapp with WTP I added a Dynamic Web Module facet and changed the "org.eclipse.wst.common.component" file of the project because the webapp is not in a WebContent directory, here is the content of the file:

<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="toto">
<wb-resource deploy-path="/" source-path="/src/main/webapp"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<property name="context-root" value="toto"/>
<property name="java-output-path" value="/toto/target/classes"/>
</wb-module>
</project-modules>

But it never deploy the content correctly, in "workspace.metadata.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\toto\" the directory structure is correct with WEB-INF and META-INF but empty, the jsp, html, css files are in "workspace.metadata.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\toto\WEB-INF\classes\" with another WEB-INF and META-INF structure but with the files.

I don't understand this at all, thanks.

+2  A: 

You shouldn't mess with facets and Eclipse configuration files manually, these files should be derived from the Maven POMs. To do so, either use the maven-eclipse-plugin to generate Eclipse specific files from your Maven project or use the m2eclipse plugin to make Eclipse able to deal with Maven projects.

Both approaches provide Maven/Eclipse integration and support the WTP (i.e. allow to get your project recognized as a dynamic project than you can Run on a Server...), but are also different. The former is very light and only generates Eclipse files, the later provides full integration, wizards, etc but is heavier. I've been an happy user of both, using one or the othe really depends of what you're looking for.

Just in case, if you decide to install m2eclipse, make sure to install the optional Maven Integration for WTP component from the the m2eclipse Extras update site..

Pascal Thivent
Thanks, I use m2eclispe but I didn't installed "Maven Integration for WTP", I've just done it and I am a little lost, could you point me some guide ?Merci
hokkos
@hokkos If you have *Maven Integration for WTP* installed, just delete your project from your workspace and reimport it back as *Existing Maven project*, it should then be WTP enabled.
Pascal Thivent
Thanks, now the structure of directories and files are correct but I have some erros :log4j:WARN No appenders could be found for logger (org.apache.catalina.startup.TldConfig).log4j:WARN Please initialize the log4j system properly.4 mai 2010 15:30:57 org.apache.catalina.core.StandardContext startGRAVE: Error listenerStart4 mai 2010 15:30:57 org.apache.catalina.core.StandardContext startGRAVE: Erreur de démarrage du contexte [/toto] suite aux erreurs précédentes
hokkos
@hokkos Hard to say what is happening exactly with the provided traces (in a 600 char box). Maybe post your logs to a paster like http://pastie.org/.
Pascal Thivent