eclipse - 在 Eclipse 中使用 GWT + Maven 项目

标签 eclipse gwt maven

我在尝试创建一个可以在 Eclipse 中使用的简单 GWT + Maven 项目时遇到了很多问题。这是我在做什么:

  • 新建 gwt-maven-plugin项目:
    mvn archetype:generate -q -DarchetypeGroupId=org.codehaus.mojo -DarchetypeArtifactId=gwt-maven-plugin -DarchetypeVersion=2.5.0-rc2 -DgroupId=myGroupId -DartifactId=myArtifactId -Dversion=1.0 -Dmodule=myModule
  • 在Eclipse中打开项目:File => Import... => Existing Maven Projects,然后选择我刚刚创建的项目。

  • 但是,我收到以下错误:
    在 Eclipse 中没有找到处理 gwt-maven-plugin:2.5.0-rc2:generateAsync 的市场条目。请参阅帮助以获取更多信息。
    在 Eclipse 中没有找到处理 gwt-maven-plugin:2.5.0-rc2:i18n 的市场条目。请参阅帮助以获取更多信息。

    我不明白这个错误信息。我找到了一个 related question on SO ,但将建议的片段添加到我的 pom.xml 似乎没有做任何事情。
    任何人都可以透露一些信息吗?

    最佳答案

    您应该告诉 m2e 忽略这些警告。一旦你执行了一个目标,异步和 i18n 目标就会自动执行,这只是 maven/eclipse 不能很好地一起玩的经典案例。

    在项目的构建部分中附加 pluginManagement(在 plugins 元素之后)

       <plugins>
              your  maven plugins here
        </plugins>
            <pluginManagement>
                <plugins>
                    <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
                    <plugin>
                        <groupId>org.eclipse.m2e</groupId>
                        <artifactId>lifecycle-mapping</artifactId>
                        <version>1.0.0</version>
                        <configuration>
                            <lifecycleMappingMetadata>
                                <pluginExecutions>
                                    <pluginExecution>
                                        <pluginExecutionFilter>
                                            <groupId>org.codehaus.mojo</groupId>
                                            <artifactId>
                                                gwt-maven-plugin
                                            </artifactId>
                                            <versionRange>
                                                [2.4.0,)
                                            </versionRange>
                                            <goals>
                                                <goal>i18n</goal>
                                                <goal>generateAsync</goal>
                                            </goals>
                                        </pluginExecutionFilter>
                                        <action>
                                            <ignore></ignore>
                                        </action>
                                    </pluginExecution>
                                </pluginExecutions>
                            </lifecycleMappingMetadata>
                        </configuration>
                    </plugin>
                </plugins>
            </pluginManagement>
    

    最后将文件夹 target/generated-sources/gwt 添加到构建路径

    关于eclipse - 在 Eclipse 中使用 GWT + Maven 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13060569/

    相关文章:

    java - IntelliJ : scala: javac: invalid source release: 1. 7

    java - 为什么我的 Maven 找不到 stripe 库?

    java - 如何自定义 Eclipse 的 getter 和 setter 生成?

    java - 在 tomcat 中部署 GWT

    java - 如何用Maven组织本地依赖?

    java - 如何生成 Kerberos 安全 token ?

    java - smartGWT 应用程序中 RPC 成功时返回 ListGridRecord[ ]

    eclipse - 如何显示多页面编辑器的标准编辑器状态栏项目

    java - 使用 Maven Replace Plugin 替换 Target/generated-sources 中生成的 Java 文件上的短语

    java - 从 Eclipse 进行单个方法调用,无需类