开发者

GWT Maven and web.xml

开发者 https://www.devze.com 2022-12-18 18:11 出处:网络
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 d

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>
  &开发者_开发百科lt;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>


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消