使用 Maven 将 GWT 源代码整合到 WAR 中的最佳实践

发布于 2024-12-06 07:46:22 字数 398 浏览 0 评论 0原文

我目前正在将我们相当庞大的项目分解为连续的部分。目的是让每次分离都成为自己的 Maven 项目。将有一个父 Maven 项目负责确保编译所有正确的部分并共享全局属性。

考虑到这一点,我们的 GWT 代码将独立于其自己的项目中,并将使用 GWT Maven 插件进行编译。另一个项目将负责创建 WAR 文件,可能使用 Cargo 插件,因为我们可能需要合并 web.xml 文件。

这里存在一个问题,如何将一个项目中已编译的 GWT 源代码获取到另一个项目将创建的 WAR 文件中?

更复杂的是,其他项目将提供功能扩展,这些项目也将在它们自己的项目中,并且这些项目将编译 GWT 源代码,需要将其包含到 WAR 中。

有人有过这方面的经验吗?有在线资源或最佳实践的指导吗?我应该寻求不同的结构吗?

谢谢。

I'm currently in the process of splitting our rather over grown project down into its consecutive parts. The intention is that each separation becomes its own Maven project. There will be a parent Maven project that's responsible for ensuring all the correct parts are compiled and global properties are shared.

With this in mind, our GWT code will be self-contained within its own project, and will be compiled using the GWT Maven plugin. Another project will be responsible for creating the WAR file, probably using the Cargo plugin as it's likely we'll need to merge web.xml files.

Here lies the question, how do I get the compiled GWT source from the one project, into the WAR file that'll be created by the another project?

What further complicates matters, is that there'll be feature extensions provided by further projects which will also be in their own projects, and these to will have compiled GWT source that'll need to be included into the WAR.

Has anyone had experience of this? Any pointers to online resources or best practices? Should I be looking to structure it differently?

Thanks.

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

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

发布评论

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

评论(1

夢归不見 2024-12-13 07:46:23

我们有类似的布局(略多于 20 个 Maven 模块)。 webapp本身由3个项目组成:共享、客户端和服务器。

  1. 共享模块是一个简单的 JAR,其中包含我们的 RequestFactory 接口以及在客户端和服务器之间共享的其他代码。

  2. 客户端模块有packaging=jar,所以在Eclipse中它被视为一个Java项目,它在prepare-package阶段运行gwt-maven-plugin,我们使用汇编插件将JS代码打包成ZIP。该模块依赖于没有classifier和classifier=sources的共享。

  3. 服务器模块是webapp,它使用客户端模块的ZIP作为war覆盖。

理想情况下,gwt-maven-plugin 将提供特定于 GWT 的新包装,以及在战争中输出它的特定目标,类似于 flexmojos;但以上几乎就是我个人所说的“完美的项目布局”。

编辑:我正在使用类似的布局处理 Maven 原型:https: //github.com/tbroyer/gwt-maven-archetypes

We have a similar layout (with slightly over 20 Maven modules). The webapp itself is composed of 3 projects: shared, client and server.

  1. The shared module is a simple JAR with our RequestFactory interfaces and other code that's shared between the client and server.

  2. The client module has packaging=jar so it's seen as a Java project in Eclipse, it runs the gwt-maven-plugin in the prepare-package phase, and we use the assembly plugin to package the JS code into a ZIP. The module depends on shared both without classifier and with classifier=sources.

  3. The server module is the webapp, and it uses the ZIP of the client module as a war overlay.

Ideally, the gwt-maven-plugin would provide a new packaging specific to GWT, and a specific goal to output it in the war, similar to the flexmojos; but the above is almost what I would personally call the "perfect project layout".

EDIT: I'm working on Maven archetypes using a similar layout: https://github.com/tbroyer/gwt-maven-archetypes

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