简体   繁体   English

GWT-Maven仅编译gwt.rpc

[英]GWT-Maven only compile gwt.rpc

I have a situation where I am debugging via -noserver and it forces me to recompile my gwt application everytime one of my RPC objects changes or I get a serialization error (This is well described in the GWT documentation and I understand why it is happening). 我遇到一种情况,我正在通过-noserver进行调试,每次我的RPC对象发生更改时,它都会迫使我重新编译gwt应用程序,或者遇到序列化错误(在GWT文档中对此进行了很好的描述,我知道为什么会发生这种情况) 。

That being said, our project is getting quite big and the compile takes a while to complete, which is slowing down our development process. 就是说,我们的项目越来越大,编译需要一段时间才能完成,这减慢了我们的开发过程。 I have optimzed this as much as I can (Using -draftCompile, only doing a single permutation, and skipping all tests) but it's still pretty slow and I have a pretty beastly computer. 我已经尽可能地优化了这一点(使用-draftCompile,仅执行单个排列,并跳过所有测试),但是它仍然很慢,并且我有一台非常出色的计算机。

This led me to wonder if a better option here would be to get the compiler to only output the necessary files to make serialization work correctly. 这使我想知道这里是否有更好的选择,是让编译器仅输出必要的文件以使序列化正常工作。

Anyone know if this is possible? 有人知道这是否可能吗?

Thanks! 谢谢!

You can do it using maven goals. 您可以使用Maven目标来实现。 In Eclipse "run configurations" I have a specific configuration for that. 在Eclipse“运行配置”中,我有一个特定的配置。

Goals: gwt:generateAsync gwt:i18n gwt:css
Profiles: dev-ff

The gwt:generateAsync goal is for generating your RPC. gwt:generateAsync目标是用于生成RPC。 This is a standard goal with gwt-maven-plugin (assuming you are using it, of course). 这是gwt-maven-plugin的标准目标(当然,假设您正在使用它)。 Profiles: dev-ff ensures I'll only generate the code for Firefox. 配置文件:dev-ff确保我只会为Firefox生成代码。

Here is a part of the maven plugin config. 这是Maven插件配置的一部分。 Notice the goals definitions. 注意目标定义。 You'll at least need the servicePattern attribute to tell the plugin where are your RPC interfaces. 您至少需要使用servicePattern属性来告诉插件RPC接口在哪里。

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>gwt-maven-plugin</artifactId>
    <version>${gwt-maven-plugin.version}</version>
    <executions>
        <execution>
            <goals>
                <goal>compile</goal>
                <goal>test</goal>
                <goal>i18n</goal>
                <goal>css</goal>
                <goal>generateAsync</goal>
            </goals>
        </execution>
    </executions>
    <!-- Plugin configuration. There are many available options, see gwt-maven-plugin 
                    documentation at codehaus.org -->
    <configuration>
        <servicePattern>**/*RPC.java</servicePattern>
    </configuration>
</plugin>

After doing this kind of operation, I often had to open my generated async files to get them in sync with Eclipse. 完成这种操作后,我经常不得不打开生成的异步文件,以使其与Eclipse同步。 Afterwards we found out we could just delete the gwt-unitCache/ folder in the target/ folder to force the application to use the new RPC classes. 之后,我们发现我们可以删除target /文件夹中的gwt-unitCache /文件夹,以强制应用程序使用新的RPC类。

More information about the plugin is available here . 有关该插件的更多信息, 请参见此处

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM