Requestfactory Validation on Multi-Project Setup

核能气质少年 提交于 2019-12-11 18:17:27

问题


I tried changing to the release version of gwt2.4 and run into a problem. I use multiple projects in my setup. I have a project with serverside code, one project with shared code, that can be used in different gwt projects and a gwt project binding everything together. I build everything with maven. i followed the instructions for annotationprocessing found here: http://code.google.com/p/google-web-toolkit/wiki/RequestFactoryInterfaceValidation

when I compile my shared project, where the proxies and services are, the folder "generated-sources\apt\" with the DeobfuscatorBuilder.java is created. I have the sources of this project as dependency of my mainproject and try to run the validator as well, but the DeobfuscatorBuilder.java is not created here. Everything compiles but when I invoke a call to the requestfactory I get the error:

com.google.web.bindery.requestfactory.server.UnexpectedException: No RequestContext for operation ZwI9iqZS626uTt_TFwRtUwPYSOE=

I guess there is an mistake in my setup, but I could't find where .. Does anybody know how to solve this problem?

Regards arne

UPDATE:

I added this to my pom:

           <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>

                <executions>
                    <execution>
                        <id>unpack</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>unpack</goal>
                            <!-- <goal>build-classpath</goal> -->
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>com.myproject.core</groupId>
                                    <artifactId>shared</artifactId>
                                    <version>${shared.version}</version>
                                    <classifier>sources</classifier>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${project.build.directory}/com.myproject.shared</outputDirectory>
                                </artifactItem>
                                </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

This unpacks the sources of my dependencies and puts them into my target folder. Then I added:

            <configuration>
                <sourceDirectory>target/com.fileee.shared</sourceDirectory>
            </configuration>

to my processor-plugin.

This way it is not necessary to have all the projects in the workspace and it should work with a continous integration system. Wouldn't have figured that out without Andys reply though :)


回答1:


I had the same issue and spent hours scouring the web for an answer without any luck. If I add the processor plugin to the shared project, it generates the DeobfuscatorBuilder class, but I get the same No RequestContext exception as you. If I just have the processsor plugin on the GWT war project, the builder isn't generated at all.

With a fair amount of trial and error I found adding the source directory from the shared project into the processor plugin configuration on the war project worked... http://code.google.com/p/android-shuffle/source/browse/shuffle-app-engine/pom.xml#269

It's a bit dirty, but it does the trick. If there's an official method that doesn't require cross project hackery I'd be more than welcome to switch, but I haven't seen anything suggested yet.

Cheers Andy



来源:https://stackoverflow.com/questions/7718320/requestfactory-validation-on-multi-project-setup

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!