如何在 GWT Maven 多模块项目中提高工作效率
我有一个大型多模块 Maven 项目,其中一小部分是用 GWT 制作的 Web GUI。我正在使用,但我不确定如何提高我的开发效率。
现在,我在开发 GWT 项目中的内容时正在运行托管模式,如果我在此处更改某些内容,我可以在重新加载页面时立即看到更改。但是,如果包含大部分后端逻辑的 Maven 模块中发生了某些更改,我需要对整个项目结构执行 mvn:install
,然后执行 gwt:run
> 再次启动托管模式。非常耗时...
我尝试按照此处的说明进行操作: http://mojo.codehaus.org/gwt-maven-plugin/user-guide/project.html#Multi-project_setup 但它无法按预期工作。
是否可以立即看到依赖的 Maven 模块中所做的更改,如果可以,pom 文件应该如何编写?
I've got a big multi module Maven project where a small part is a web GUI made in GWT. I'm using but I'm not sure on how to make my development efficient.
Right now I'm running hosted mode when developing stuff that's in the GWT project, and if I change something here it, I'm able to see the changes instantly when reloading the page. But if something is changed in the maven modules that holds most of the backend logic, I need to do mvn:install
on the whole project structure, and the do a gwt:run
to launch the hosted mode again. Very time consuming...
I've tried to follow the instructions here: http://mojo.codehaus.org/gwt-maven-plugin/user-guide/project.html#Multi-project_setup but it doesn't work as expected.
Is it possible to instantly see the changes made in dependent maven modules, and if so - how should the pom files be written?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果您使用 Eclipse 和 m2eclipse,您可以将项目配置为 m2eclipse。 sonatype.com/books/m2eclipse-book/reference/dependency.html#dependency-sect-resolving-dependencies" rel="nofollow">解析工作区中的依赖项。引用 m2eclipse 手册:
通过此设置,无需在相关模块上调用
mvn:install
。我一直将此设置与 JRebel 结合使用,以跨多模块 Maven 项目即时重新加载类已经有一段时间了。If you are using Eclipse and m2eclipse you can configure your project to resolve dependencies from workspace. To quote from the m2eclipse manual:
With this setup it there is no need to call
mvn:install
on related modules. I have been using this setup in combination with JRebel to get instant reloading of classes across multi-module maven projects for quite a while now.解决工作区的依赖关系对我来说不起作用。
我的解决方案:手动将后端项目依赖项添加到运行配置中。
Resolving dependencies from the workspace doesnt work for me.
My solution : manually add the backend project dependency to the run configuration.
关联的 maven 子模块是库依赖项,必须位于 WEB-INF/lib 目录中。必须在顶层执行 mvn:install 的原因是,在构建关联的子模块时必须重新生成 jar,然后在打包 war 时将其复制到 WEB-INF/lib 目录中项目发生。
如果您能想出一种方法让您的 IDE 或其他工具自动更新 WEB-INF/lib 目录中的 JAR,那么您应该做得很好。您可以尝试让 IDE 自动将关联项目编译为 WEB-INF/lib 目录下的分解 JAR 结构。是否会被拾取取决于您的 Web 容器。我认为 Tomcat 可能会同意这一点,但我不确定 Jetty 是否如此。我很快就会亲自尝试一下。
The associated maven sub-modules are library dependencies that have to be in the WEB-INF/lib directory. The reason you have to do a mvn:install at the top-level is that you have to regenerate the jar when its building the associated sub-module, then have it copied into the WEB-INF/lib directory when the packaging for the war project occurs.
If you can come up with a way to make your IDE or some other tool auto-update the JAR in the WEB-INF/lib directory, then you should be good. You might try having your IDE auto-compile your associated project as an exploded JAR structure under the WEB-INF/lib directory. It will depend on your Web container whether this will be picked up or not. I think Tomcat would probably be ok with this, but I'm not sure about Jetty. I'm going to try this myself shortly.
我遇到了同样的问题,我为 gwt-maven-plugin 创建了一个“代理”插件。
你可以在这里查看
https://github.com/xptdev/modgwt-maven-plugin
I had the same problem, i have created a "proxy" plugin to the gwt-maven-plugin.
You can check it out here
https://github.com/xptdev/modgwt-maven-plugin