【问题标题】:Setting up GWT project with maven in Eclipse在 Eclipse 中使用 maven 设置 GWT 项目
【发布时间】:2016-02-16 07:25:27
【问题描述】:

我正在尝试使用 Maven 在 Eclipse 中设置一个 Maven 项目。到目前为止我尝试过的:

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

问题: - Eclispe 不提供任何运行配置

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

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

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

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

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

    mvn 原型:生成

    org.codehaus.mojo:gwt-maven-plugin

    选择原型:

    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 项目。

  1. 我想从这里创建一个具有 2.8.0 原型的项目:

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

我到底做错了什么?

【问题讨论】:

    标签: java eclipse maven gwt


    【解决方案1】:

    请试一试:

    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 中测试。

    【讨论】:

      【解决方案2】:

      您使用了错误版本的 gwt maven 插件。 2.8.0-SNAPSHOT 版本在 Maven 存储库中不可用。

      查看下面的链接以在 maven 存储库中找到插件的已发布版本。 http://mvnrepository.com/artifact/org.codehaus.mojo/gwt-maven-plugin

      【讨论】:

      • 好吧,那你为什么要使用那个原型呢?我的意思是,他们在他们的网站上展示了如何使用它......
      • 尝试使用 2.7.0 使用命令 mvn archetype:generate \ -DarchetypeGroupId=org.codehaus.mojo \ -DarchetypeArtifactId=gwt-maven-plugin \ -DarchetypeVersion=2.7.0
      • 我已经这样做了。请参阅我在问题中的前两点。然后我遇到了 Eclipse 无法将该项目识别为 GWT 项目的问题。
      猜你喜欢
      • 2012-10-15
      • 2012-06-03
      • 2011-12-07
      • 2013-09-30
      • 1970-01-01
      • 2012-10-03
      • 1970-01-01
      • 2012-02-02
      • 2011-01-21
      相关资源
      最近更新 更多