【问题标题】:How to turn off auto-generation of the GWT Asynchronous RPC interface in Maven如何在 Maven 中关闭 GWT 异步 RPC 接口的自动生成
【发布时间】:2013-08-15 11:29:16
【问题描述】:

我正在使用 Java RPC 服务在我的 GWT 应用程序中的服务器端和客户端之间进行通信。我不想从我的版本控制中删除异步接口,因为它是项目编译和运行所必需的。

但是,Async 接口是由 Maven 插件在 target/generated-sources 文件夹中自动生成的(与 Messages 类一起),并且当应用程序尝试运行时出现重复类错误。

有人知道如何禁用异步 RPC 接口的自动生成吗?

【问题讨论】:

    标签: maven gwt code-generation rpc gwt-rpc


    【解决方案1】:

    我通过这个问题找到了答案:

    How to configure IntelliJ IDEA and/or Maven to automatically add directories with Java source code generated using jaxb2-maven-plugin?

    然后查看 Mojo 网站上的 Maven GWT 插件:

    http://mojo.codehaus.org/gwt-maven-plugin/user-guide/async.html

    ...所以生成代码的不是 IDEA,而是 GWT Maven 插件。我通过在我的 pom 中注释掉以下两行来禁用 Async RPC 和 i18n 消息接口的自动生成:

    <goal>i18n</goal>
    <goal>generateAsync</goal>
    

    所以 pom.xml 中的插件定义现在看起来像:

     <plugin>
       <groupId>org.codehaus.mojo</groupId>
          <artifactId>gwt-maven-plugin</artifactId>
            <version>2.5.0</version>
            <executions>
              <execution>
                <goals>
                  <goal>compile</goal>
                  <goal>test</goal>
                  <!--<goal>i18n</goal>-->
                  <!--<goal>generateAsync</goal>-->
                </goals>
     . . .
    

    问题就解决了。

    【讨论】:

      【解决方案2】:

      实际上评论您的 POM 并不是最好的方法。 我不了解 IDEA,但使用 Eclipse“运行配置”,您可以指定要执行的目标。我猜IDEA一定有something similar (see link)

      例如,我会有两个不同的跑步者。一个有目标的人

      gwt:generateAsync gwt:i18n gwt:css
      

      一个没有具体目标的,它将执行一个完整的构建。

      clean install
      

      在你的情况下,你会想要

      gwt:compile gwt:test
      

      如果您从不想执行 gwt:generateAsync 目标,删除它可能是一个不错的选择。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-11-01
        • 1970-01-01
        • 2011-10-01
        • 1970-01-01
        • 2010-12-16
        相关资源
        最近更新 更多