Maven和GWT(和Eclipse) - 它真的有效吗? [英] Maven and GWT (and Eclipse) - Does it really work?

查看:161
本文介绍了Maven和GWT(和Eclipse) - 它真的有效吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在过去几天里,我一直在使用gwt-maven-plugin在Eclipse中创建/运行一个项目,并继续运行到路障(见我之前的一些问题)。我喜欢使用Maven来做我的构建,但是我正在考虑使用Maven的蚂蚁构建路线。



有没有人有配置/工作良好?只是我还是比这应该更难?

解决方案

经过很多的挫败,试图让事情一起玩,这是我对我的工作的设置。 Works意味着我可以通过调整创建,运行和调试GWT项目,但并不是最优雅的解决方案。



创建项目



大部分步骤与Pascal在本文中的答案相同: Maven GWT 2.0和Eclipse 。我将列出我的清单。



在Eclipse(Helios)中安装了m2eclipse和GWT安装Eclipse插件:



使用gwt-maven-plugin原型创建一个新的Maven项目



修改pom.xml:




  • 设置< gwt.version属性> 到2.0.4
    (需要与GWT相同Eclipse
    插件版本)

  • 设置< maven.compiler.source>
    < maven .compiler.target> 属性到
    1.6

  • 删除< goal> generateAsync< / goal>
    from gwt-maven-plugin < plugin> config

  • 将maven-war-plugin添加到pom .xml



maven-war-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>

更新项目属性:




  • Google - > Web Toolkit,查看使用Google Web Toolkit框,并确保选择使用默认SDK(GWT-2.0.4)。



运行Mavengwt:eclipse项目目标(设置环境和启动配置)



将* .launch文件复制到工作区.metadata.plugins\org.eclipse.debug.core.launches



重新启动Eclipse



编译/运行项目



我创建了一个运行配置,执行 mvn clean compile gwt:run 。gwt:run是必需的将资源和lib jar复制到war目录中,但是不会将web.xml从src / main / webapp / WEB-INF复制到war / WEB-INF /中,所以我必须手动复制该文件。 / p>

如果我想运行我的应用程序,上述步骤就足够了,但是如果我想调试应用程序,我通过选择GoogleWeb应用程序配置启动它从在以前复制.launch文件时创建的调试配置。此配置允许调试(断点等),无需任何其他配置或需要远程调试。


Over the past few days I have been trying to create/run a project in Eclipse using the gwt-maven-plugin and keep running into roadblocks (see some of my previous questions). I like to use Maven to do my builds, but I'm at the point where I'm thinking of going the Ant build route because of the complications of using Maven.

Does anyone out there have it configured/working well? Is it just me or is this harder than it should be?

解决方案

After much frustration trying to get things to play nicely together, this is the setup I have that "works" for me. "Works" meaning that I can create, run and debug a GWT project with tweaks, but it isn't the most elegant solution.

Create Project

Much of the steps are the same as Pascal's answer in this post: Maven GWT 2.0 and Eclipse. I'll list mine out to be clear.

In Eclipse (Helios) with m2eclipse and GWT Eclipse plugins installed:

Create a new Maven project using the gwt-maven-plugin archetype

Modify the pom.xml:

  • set <gwt.version property> to 2.0.4 (needs to be same as GWT Eclipse Plugin version)
  • set <maven.compiler.source> and <maven.compiler.target> properties to 1.6
  • remove <goal>generateAsync</goal> from gwt-maven-plugin <plugin> config
  • add maven-war-plugin to pom.xml

maven-war-plugin example:

<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>

Update project Properties:

  • Google -> Web Toolkit, check the "Use Google Web Toolkit" box, and ensure "Use default SDK (GWT-2.0.4) is selected.

Run Maven "gwt:eclipse" goal on project (sets up environment and launch config)

Copy *.launch file to workspace.metadata.plugins\org.eclipse.debug.core.launches

Restart Eclipse

Compile/Run Project

I created a Run Configuration that does mvn clean compile gwt:run. The gwt:run is necessary to copy the resources and lib jars into the war directory. However, it does not copy the web.xml from src/main/webapp/WEB-INF into war/WEB-INF/. So, I have to manually copy that file.

If I want to run my application, the above step is sufficient. However, if I want to debug the application, I launch it by choosing the Google "Web Application" configuration from Debug Configurations that was created when the .launch file was copied previously. This configuration allows for debugging (breakpoints etc.) without any other config or need for remote debugging.

这篇关于Maven和GWT(和Eclipse) - 它真的有效吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆