views:

561

answers:

1

I'm using the GWT Maven plugin from Codehaus with m2eclipse. Where is my web.xml file supposed to end up? Isn't the Maven build supposed to copy it to the /war directory? I can't see it there. Or does Jetty pick it up automatically from src/main/webapp/WEB-INF/?

Here's a relevant section from my pom.xml.

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-war-plugin</artifactId>
  <version>2.0.2</version>
  <configuration>
  <warSourceDirectory>war</warSourceDirectory>
  <webXml>src/main/webapp/WEB-INF/web.xml</webXml>
  </configuration>
</plugin>
+1  A: 

I believe web.xml (and everything else under src/main/webapp/) gets copied into target/<projectname>-<version>/ during the normal maven lifecycle (For example, when you run mvn install).

If you're running any of the gwt-maven plugin goals, then check out this link.

When running gwt:run, if you want to run the full web app just as if you have built and deployed a war, I found the best way is to add the following to the configuration for the gwt-maven plugin:

<hostedWebapp>
            ${project.build.directory}/${project.build.finalName}
</hostedWebapp>

This tells gwt-maven plugin to look for the web.xml (and all the other parts of the war file) under target/<projectname>-<version>/. So make sure to either run mvn install first (or mvn war:exploded), then run mvn gwt:run and you should be set.

Dave Paroulek