Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
186 views
in Technique[技术] by (71.8m points)

gwt - Requestfactory Validation on Multi-Project Setup

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-sourcesapt" 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 :)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...