开发者

Best practice for bringing together GWT source into a WAR using Maven

开发者 https://www.devze.com 2023-04-08 12:25 出处:网络
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 Ma

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 开发者_C百科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.


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

0

精彩评论

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

关注公众号