Gwt java.lang.RuntimeException:必须运行RequestFactory ValidationTool

Gwt java.lang.RuntimeException:必须运行RequestFactory ValidationTool,gwt,requestfactory,Gwt,Requestfactory,我一整天都被这件事困住了。我浏览了几乎所有关于这个问题的链接。我也按照上面的说明做了 我还是会犯这个错误,不知道为什么 我在这里快发疯了。请帮忙。这里还有什么我不知道的吗 这是我的pom.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

我一整天都被这件事困住了。我浏览了几乎所有关于这个问题的链接。我也按照上面的说明做了

我还是会犯这个错误,不知道为什么

我在这里快发疯了。请帮忙。这里还有什么我不知道的吗

这是我的pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <!-- POM file generated with GWT webAppCreator -->
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.kivar.lumina</groupId>
    <artifactId>client</artifactId>
    <packaging>war</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>GWT Maven Archetype</name>

    <properties>
        <!-- Convenience property to set the GWT version -->
        <gwtVersion>2.5.1</gwtVersion>
        <!-- GWT needs at least java 1.5 -->
        <webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-servlet</artifactId>
            <version>${gwtVersion}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-user</artifactId>
            <version>${gwtVersion}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.7</version>
            <scope>test</scope>
        </dependency>

        <!-- RequestFactory server -->

        <dependency>
            <groupId>com.google.web.bindery</groupId>
            <artifactId>requestfactory-server</artifactId>
            <version>${gwtVersion}</version>
        </dependency>

        <!-- Hibernate dependencies -->
        <!-- <dependency> <groupId>javax.validation</groupId> <artifactId>validation-api</artifactId> 
            <version>1.0.0.GA</version> </dependency> <dependency> <groupId>org.hibernate</groupId> 
            <artifactId>hibernate-entitymanager</artifactId> <version>4.2.1.Final</version> 
            </dependency> -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>4.2.1.Final</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>4.3.1.Final</version>
        </dependency>
        <!-- Required by Hibernate validator because slf4j-log4j is optional in 
            the hibernate-validator POM -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.6.1</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.6.1</version>
        </dependency>

        <!-- Oracle JDBC driver -->
        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc6</artifactId>
            <version>11.2.0.3</version>
        </dependency>


    </dependencies>

    <repositories>
        <repository>
            <id>codelds</id>
            <url>https://code.lds.org/nexus/content/groups/main-repo</url>
        </repository>
    </repositories>

    <build>
        <!-- Generate compiled stuff in the folder used for developing mode -->
        <outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>

        <pluginManagement>
            <plugins>
                <!-- GWT Maven Plugin -->
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>gwt-maven-plugin</artifactId>
                    <version>2.5.1</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>compile</goal>
                                <goal>test</goal>
                                <goal>i18n</goal>
                                <goal>generateAsync</goal>
                            </goals>
                        </execution>
                    </executions>
                    <!-- Plugin configuration. There are many available options, see gwt-maven-plugin 
                        documentation at codehaus.org -->
                    <configuration>
                        <runTarget>Application.html</runTarget>
                        <hostedWebapp>${webappDirectory}</hostedWebapp>
                        <i18nMessagesBundle>com.kivar.lumina.client.Messages</i18nMessagesBundle>
                    </configuration>
                </plugin>

                <!-- Copy static web files before executing gwt:run -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>2.1.1</version>
                    <executions>
                        <execution>
                            <phase>compile</phase>
                            <goals>
                                <goal>exploded</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <webappDirectory>${webappDirectory}</webappDirectory>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>2.3.2</version>
                    <configuration>
                        <source>1.7</source>
                        <target>1.7</target>
                    </configuration>
                </plugin>

                <!-- RequestFactory Validation jar -->
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>2.5.1</version>
                    <configuration>
                        <source>1.6</source>
                        <target>1.6</target>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>com.google.web.bindery</groupId>
                            <artifactId>requestfactory-apt</artifactId>
                            <version>${gwtVersion}</version>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

</project>

4.0.0
com.kivar.lumina
客户
战争
1.0-快照
GWT Maven原型
2.5.1
${project.build.directory}/${project.build.finalName}
UTF-8
com.google.gwt
gwt servlet
${gwtVersion}
运行时
com.google.gwt
gwt用户
${gwtVersion}
假如
朱尼特
朱尼特
4.7
测试
com.google.web.bindery
请求工厂服务器
${gwtVersion}
org.hibernate
冬眠核心
4.2.1.最终版本
org.hibernate
休眠验证器
4.3.1.最终版本
org.slf4j
slf4j-log4j12
1.6.1
org.slf4j
slf4j api
1.6.1
com.oracle
ojdbc6
11.2.0.3
科德尔
https://code.lds.org/nexus/content/groups/main-repo
${webappDirectory}/WEB-INF/classes
org.codehaus.mojo
GWTMaven插件
2.5.1
编译
测试
i18n
生成同步
Application.html
${webappDirectory}
com.kivar.lumina.client.Messages
org.apache.maven.plugins
maven战争插件
2.1.1
编译
爆炸了的
${webappDirectory}
org.apache.maven.plugins
maven编译器插件
2.3.2
1.7
1.7
maven编译器插件
2.5.1
1.6
1.6
com.google.web.bindery
请求工厂公寓
${gwtVersion}

这里还缺少什么吗???

如评论中所述,您需要有“YourRequestFactory”DeobfuscatorBuilder.class文件才能运行它。我也有类似的问题,需要非Eclipse依赖的解决方案。我用以下方法解决了这个问题:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.5.1</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
                <annotationProcessors>
                     <annotationProcessor>com.google.web.bindery.requestfactory.apt.RfValidator</annotationProcessor>
                </annotationProcessors>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>com.google.web.bindery</groupId>
                    <artifactId>requestfactory-apt</artifactId>
                    <version>${gwtVersion}</version>
                </dependency>
            </dependencies>
        </plugin>
windows.bat文件示例(将cd插入JDK目录以运行JDK java而不是JRE java):


此外,即使我不是Maven大师,我也不确定在Maven中使用双Maven编译器插件声明是否会在某种程度上导致在构建时未运行验证。

要在
Maven编译器插件
3.*中工作,您需要一个额外的配置键:
forceJavacCompilerUse
。完整示例可能如下所示:


org.apache.maven.plugins
maven编译器插件
3.1
真的
com.google.web.bindery
请求工厂公寓
2.6.1


您不需要事件处理器配置部分,因为maven编译器插件可以自动发现并应用RequestFactory注释处理工具。

从Eclipse或其他IDE启动GWT应用程序时,似乎会出现此问题。在maven我还没见过


解决此问题的方法是使用Maven启动应用程序以创建
xxx.yyydeobfouscatorbuilder
类,然后您可以从Eclipse启动GWT应用程序而不会出现问题在
${webappDirectory}/WEB-INF/classes
中是否有
xxx.yyydeobfouscatorbuilder
类?(其中,
xxx.yyy
是您的
RequestFactory
接口的完全限定名)此外,您是否仅在DevMode中有问题?从Eclipse或mvn gwt启动:运行?还是也在prod模式下?只是在Dev模式下,长官。我看不见你说的那门课。它是从日食开始发射的。生产模式我还没有看到,因为我无法通过这一点明确。但是,当我给mvn安装提供
mvn安装时,它成功地完成了。您是否在Eclipse中配置了注释处理?使用JBoss?的m2e apt插件,我已经在eclipse中启用了注释处理。在
Factory path
中,我还使用这个脚本为requestfactory提供了apt-jar脚本,非常感谢。Maven的解决方案对我来说就像一个符咒……或是启用注释
java -cp <your_set_classpath> com.google.web.bindery.requestfactory.apt.ValidationTool <your wanna-be RequestFactory class to be validated> <another wannae-be factory>...
set loc=d:\coding\java\workspace\j2ee\beg_1\Allo\web\src\main\java\
set tool=d:\coding\tools\Maven\.m2\repository\com\google\web\bindery\requestfactory-apt\2.5.1\requestfactory-apt-2.5.1.jar
set server=d:\coding\tools\Maven\.m2\repository\com\google\web\bindery\requestfactory-server\2.5.1\requestfactory-server-2.5.1.jar
set lib=d:\coding\tools\Maven\.m2\repository\bbc\juniperus\allo-entities\1.0\allo-entities-1.0.jar
set lib2=d:\coding\tools\Maven\.m2\repository\org\hibernate\javax\persistence\hibernate-jpa-2.0-api\1.0.1.Final\hibernate-jpa-2.0-api-1.0.1.Final.jar

set CP=%loc%;%tool%;%server%;%lib%;%lib2%

cd %JAVA_HOME%/bin

java -cp %CP% com.google.web.bindery.requestfactory.apt.ValidationTool d:/output.jar bbc.juniperus.allo.web.gwt.client.CalendarRequestFactory"