【问题标题】:gwt-maven-plugin failing on gwt-appgwt-maven-plugin 在 gwt-app 上失败
【发布时间】:2018-12-27 13:37:42
【问题描述】:

我在让 gwt-maven-plugin 像文档所说的那样工作时遇到问题。 使用 GWT 2.8.2 使用 InteliJ 2018 从使用模板 maven、sample、readme 的 2.8.2 webAppCreator 生成的示例项目开始。

该基本项目的打包设置为战争

<!-- POM file generated with GWT webAppCreator -->
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.gwtproject.tutorial</groupId>
  <artifactId>TodoList</artifactId>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>org.gwtproject.tutorial.TodoList</name>

The gwt-maven-plugin is set to 1.0-rc-8
 <!-- GWT Maven Plugin-->
      <plugin>
        <groupId>net.ltgt.gwt.maven</groupId>
        <artifactId>gwt-maven-plugin</artifactId>
        <version>1.0-rc-8</version>
        <executions>
          <execution>
            <goals>
              <goal>compile</goal>
              <goal>test</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <moduleName>org.gwtproject.tutorial.TodoList</moduleName>
          <moduleShortName>TodoList</moduleShortName>
          <failOnError>true</failOnError>
          <!-- GWT compiler 2.8 requires 1.8, hence define sourceLevel here if you use
               a different source language for java compilation -->
          <sourceLevel>1.8</sourceLevel>
          <!-- Compiler configuration -->
          <compilerArgs>
            <!-- Ask GWT to create the Story of Your Compile (SOYC) (gwt:compile) -->
            <arg>-compileReport</arg>
            <arg>-XcompilerMetrics</arg>
          </compilerArgs>
          <!-- DevMode configuration -->
          <warDir>${project.build.directory}/${project.build.finalName}</warDir>
          <classpathScope>compile+runtime</classpathScope>
          <!-- URL(s) that should be opened by DevMode (gwt:devmode). -->
          <startupUrls>
            <startupUrl>TodoList.html</startupUrl>
          </startupUrls>
        </configuration>
      </plugin>

此时我可以在 DEV 模式下运行。一旦我将包装更改为 gwt-app(根据插件的文档https://tbroyer.github.io/gwt-maven-plugin/usage.html),它就会失败。

[ERROR] Unknown packaging: gwt-app @ line 9, column 14
 @ 
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project org.gwtproject.tutorial:TodoList:1.0-SNAPSHOT (D:\ToDoList\pom.xml) has 1 error
[ERROR]     Unknown packaging: gwt-app @ line 9, column 14
[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]

对这个问题有任何想法吗?

谢谢

【问题讨论】:

    标签: java gwt gwt-maven-plugin


    【解决方案1】:

    您可能在插件中缺少&lt;extensions&gt;true&lt;/extensions&gt;。

    请注意,gwt-app 只是客户端代码,根本没有服务器端代码。我建议使用 https://github.com/tbroyer/gwt-maven-archetypes 而不是 webAppCreator 作为起点。模块化 webapp 原型在功能上与 webAppCreator 生成的示例项目相同,但设置更面向 Maven。

    【讨论】:

    • 如果您可以使用 Broyer 插件groups.google.com/g/google-web-toolkit/c/TclImrErWMY/m/…查看同样的 gwt-app 错误,我将不胜感激
    • 将插件移到pluginManagement之外。
    • 谢谢。我在使用文档中没有看到它。请考虑将此说明添加到您的插件的文档中,因为它会造成混淆,因为其他插件位于 PluginManagement. 而不是 &lt;build&gt;
    • 该文档假定您了解 Maven:maven.apache.org/guides/mini/guide-configuring-plugins.html、maven.apache.org/pom.html#plugin-management。从最后一个链接:“但是,这仅配置在子级或当前 POM 中的 plugins 元素中实际引用的插件。”
    • 也可能是因为您的插件不是像 Mojo Codehaus 插件这样的组织的一部分,所以您的插件在我雇主的存储库中不可用。我们严禁在公司回购之外下载和使用任何东西。所以我挠头想知道如何让 Mojo 插件工作。
    猜你喜欢
    • 1970-01-01
    • 2014-07-23
    • 1970-01-01
    • 2012-08-31
    • 2011-11-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-26
    相关资源
    最近更新 更多