GWT Maven 和 web.xml

发布于 2024-08-19 17:45:03 字数 564 浏览 4 评论 0原文

我将 Codehaus 的 GWT Maven 插件与 m2eclipse 一起使用。我的 web.xml 文件最终应该存放在哪里? Maven 构建不是应该将其复制到 /war 目录吗?我在那里看不到它。或者 Jetty 是否自动从 src/main/webapp/WEB-INF/ 获取它?

这是我的 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>

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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

初见你 2024-08-26 17:45:03

我相信 web.xml (以及 src/main/webapp/ 下的其他所有内容)都会在正常的 Maven 过程中复制到 target/-/ 中生命周期(例如,当您运行 mvn install 时)。

如果您正在运行任何 gwt-maven 插件目标,请查看 此链接

运行 gwt:run 时,如果您想运行完整的 Web 应用程序,就像构建并部署了战争一样,我发现最好的方法是将以下内容添加到 gwt-maven 插件的配置中:

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

这告诉 gwt- maven 插件,用于在 target/-/ 下查找 web.xml(以及 war 文件的所有其他部分)。因此,请确保先运行mvn install(或mvn war:exploded),然后运行mvn gwt:run,然后就可以设置了。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文