java - 在 Eclipse 中使用 Maven 设置 GWT 项目

标签 java eclipse maven gwt

我正在尝试使用 Maven 在 Eclipse 中建立一个 Maven 项目。到目前为止我已经尝试过:

  1. 通过创建新的 Maven 项目并选择版本 2.7.0 中的 org.codehouse.mojo gwt-maven-plugin 在 Eclipse 中创建项目。

问题: - Eclispe 没有为我提供任何运行配置

因此,我转到项目的属性,转到 Google 选项卡,将 Eclipse 指向 webapp 文件夹,然后检查显示“使用 Google Web Toolkit”的 chedkbox。

之后,Eclipse 确实将我的项目识别为 GWT 项目,但是,它在我的构建路径中添加了几个 jar(我认为这不是必需的,因为我正在使用 Maven,并且相同的 jar 已被列为 maven依赖项),当我在 super 开发模式下运行它时,我收到此错误:

Missing required argument 'module[s]'
Google Web Toolkit 2.7.0

此外,当我右键单击并选择 Google > GWT 编译时,它告诉我我的项目不是 GWT 项目。

  • 我使用命令行创建了项目:

    mvn 原型(prototype):生成

    org.codehaus.mojo:gwt-maven-plugin

    选择原型(prototype):

    1:远程 -> org.codehaus.mojo:gwt-maven-plugin(Google Web Toolkit 的 Maven 插件。)

    选择数字或应用过滤器(格式:[groupId:]artifactId,区分大小写): : 1

    org.codehaus.mojo:gwt-maven-plugin 版本:

    23:2.7.0

  • 项目已成功生成,我将其作为maven项目导入到Eclipse中。同样,Eclipse 无法将其识别为 GWT 项目。

  • 我想从这里创建一个具有 2.8.0 原型(prototype)的项目:
  • https://gwt-maven-plugin.github.io/gwt-maven-plugin/user-guide/archetype.html

    但是,我收到此错误:

    mvn archetype:generate -DarchetypeGroupId=org.codehaus.mojo -DarchetypeArtifactId=gwt-maven-plugin -DarchetypeVersion=2.8.0-SNAPSHOT
    [INFO] Scanning for projects...
    [INFO]
    [INFO] ------------------------------------------------------------------------
    [INFO] Building Maven Stub Project (No POM) 1
    [INFO] ------------------------------------------------------------------------
    [INFO]
    [INFO] >>> maven-archetype-plugin:2.4:generate (default-cli) > generate-sources @ standalone-pom >>>
    [INFO]
    [INFO] <<< maven-archetype-plugin:2.4:generate (default-cli) < generate-sources @ standalone-pom <<<
    [INFO]
    [INFO] --- maven-archetype-plugin:2.4:generate (default-cli) @ standalone-pom ---
    [INFO] Generating project in Interactive mode
    [INFO] Archetype repository not defined. Using the one from [org.codehaus.mojo:gwt-maven-plugin:2.7.0] found in catalog remote
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 17.449 s
    [INFO] Finished at: 2015-11-14T23:47:50+01:00
    [INFO] Final Memory: 13M/182M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.4:generate (default-cli) on project standalone-pom: The desired archetype does not exist (org.codehaus.mojo:gwt-ma
    ven-plugin:2.8.0-SNAPSHOT) -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
    

    我到底做错了什么?

    最佳答案

    请尝试一下:

    mvn archetype:generate -DarchetypeGroupId=org.codehaus.mojo -DarchetypeArtifactId=gwt-maven-plugin -DarchetypeVersion=2.8.0
    

    使用最新的 Google GWT 插件在 Jdk 1.7 和 Maven 3.3.9 环境以及 Eclipse Mars 中进行了测试。

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

    相关文章:

    java - 在 Eclipse 中调试 Maven WAR 项目?

    java - 在 for 循环中表示整个数组的正确方法是什么?

    java - Windows 操作系统上 java.security.SecureRandom 的种子

    Java 和 FTP 服务器

    android - 在控制台中应用 Logcat 过滤器 ^(?!.*(nativeGetEnabledTags)).*$

    java - 在 Android Studio 中添加外部库时出现问题

    java - 如果用户不验证电子邮件,会发生什么?

    java - Applet 和 Swing 在 Eclipse 中不显示组件

    java - Maven:无法检测依赖项中的包

    java - 为 DS-2542(XOAI 日期粒度)修补 Dspace 不会导致行为发生变化