如何在maven中将gwt应用程序打包为war文件?

发布于 2024-12-27 17:36:32 字数 895 浏览 4 评论 0原文

我们正在使用 gwt-maven-plugin:2.4.0
mvncompile 工作正常。
但是,mvn package 不起作用并最终出现以下错误。 CLASSPATH 看起来确实正确,并且包含 gwt/2.4.0

.gwt.xml 的用户和服务器部分的所有类,看起来也正确。

不确定这是否是我们应该用来创建包含生成的 war 文件的包的正确生命周期阶段。 ? 我们首先如何生成涉及 gwt 的包?

[INFO] --- gwt-maven-plugin:2.4.0:compile (default) @ xyz-alp-ui-web ---
[INFO] auto discovered modules [com.xyz.solutions.alp.alpui]
[INFO] Compiling module com.xyz.solutions.alp.alpui
[INFO]    
[ERROR] Errors in 'file:/Z:/xyz-alp-ui-web/src/main/java/com/xyz/solutions/alp/client/ApplicationController.java'
[INFO]
[ERROR]  Internal compiler error
[INFO] java.lang.NoClassDefFoundError: com/google/gwt/autobean/shared/AutoBeanFactory

我有 com\google\gwt\gwt-user\2.4.0\gwt-user-2.4.0.jarcom\google\gwt\gwt-dev\2.4.0\类路径中的 gwt-dev-2.4.0.jar
我们使用的是maven 3.0

We are using gwt-maven-plugin:2.4.0
mvn compile does work fine.
However mvn package does not work and ends up with a following error. The CLASSPATH does look right and contains all the classes of user and server part of gwt/2.4.0

.gwt.xml does look right too.

Not sure if this is the right life cycle phase we should be using to create the package that contains generated war file. ?
How do we generate the package in the first place, where gwt is involved ?

[INFO] --- gwt-maven-plugin:2.4.0:compile (default) @ xyz-alp-ui-web ---
[INFO] auto discovered modules [com.xyz.solutions.alp.alpui]
[INFO] Compiling module com.xyz.solutions.alp.alpui
[INFO]    
[ERROR] Errors in 'file:/Z:/xyz-alp-ui-web/src/main/java/com/xyz/solutions/alp/client/ApplicationController.java'
[INFO]
[ERROR]  Internal compiler error
[INFO] java.lang.NoClassDefFoundError: com/google/gwt/autobean/shared/AutoBeanFactory

I have com\google\gwt\gwt-user\2.4.0\gwt-user-2.4.0.jar, com\google\gwt\gwt-dev\2.4.0\gwt-dev-2.4.0.jar in classpath.
We are using maven 3.0

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

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

发布评论

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

评论(1

莫相离 2025-01-03 17:36:32

gwt-servlet.jar 放入依赖项列表中。

<dependency>
      <groupId>com.google.gwt</groupId>
      <artifactId>gwt-servlet</artifactId>
      <version>2.4.0</version>
      <scope>compile</scope>
</dependency>

您可以调整范围设置,在运行时编译之间更改它以满足您的需求。哦,还有一件事:从您的 pom.xml 中删除 gwt-dev,如 Kabram 上面所述。

Place gwt-servlet.jar in your dependencies list.

<dependency>
      <groupId>com.google.gwt</groupId>
      <artifactId>gwt-servlet</artifactId>
      <version>2.4.0</version>
      <scope>compile</scope>
</dependency>

you can fiddle with scope setting changing it between runtime and complile to suit your needs. Oh and one more thing: remove gwt-dev from your pom.xml, as kabram stated above.

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