2013-05-15 37 views
0

我一直陷入这一整天。我经历了几乎所有可用于此问题的链接。我也遵循https://code.google.com/p/google-web-toolkit/wiki/RequestFactoryInterfaceValidation#ValidationTool的说明java.lang.RuntimeException:必须运行RequestFactory ValidationTool

我仍然得到那个错误不知道为什么。

我只是在这里疯狂。请帮忙。还有什么其他东西在这里失踪?

这是我的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> 

是否还有其他是缺少在这里?

+0

是否有'$'一类xxx.yyyDeobfuscatorBuilder' { webappDirectory}/WEB-INF/classes'? (其中'xxx.yyy'是你的'RequestFactory'接口的完全限定名称)另外,你是否仅在DevMode中有问题?从Eclipse或'mvn gwt:run'启动?或在产品模式呢? –

+0

它只在开发模式下,先生。我无法看到你正在谈论的课程。它从Eclipse启动。生产模式我根本没有看到,因为我无法清楚这一点。但是当我给'mvn install'成功完成 – LPD

+0

你在Eclipse中配置了注释处理吗?使用JBoss的m2e-apt插件? –

回答

2

正如在评论中提到的,你需要有“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> 

另一种选择是直接使用com.google.web.bindery.requestfactory.apt.ValidationTool工具。你需要从JDK的Java(不是JRE)运行它,并有

requestfactory-的apt-2.5.1.jar
requestfactory服务器-2.5.1.jar
你想成为的RequestFactory类和它们的依赖关系

在类路径上。用$ {gwtVersion}替换2.5.1。你运行它只是

java -cp <your_set_classpath> com.google.web.bindery.requestfactory.apt.ValidationTool <your wanna-be RequestFactory class to be validated> <another wannae-be factory>... 

示例.bat文件(CD-ED JDK的目录来运行,而不是JRE JAVA JDK的Java)窗口:

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" 

而且即使我没有Maven的大师我不确定是否在Maven中使用maven-compiler-plugin声明无法以某种方式促进构建时未运行的验证。

+0

非常感谢Maven解决方案为我工作,就像一个魅力 –

0

让事情在maven-compiler-plugin3. *你需要一个额外的配置密钥:forceJavacCompilerUse。完整的例子可能是这样的:

<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <forceJavacCompilerUse>true</forceJavacCompilerUse> </configuration> <dependencies> <dependency> <groupId>com.google.web.bindery</groupId> <artifactId>requestfactory-apt</artifactId> <version>2.6.1</version> </dependency> </dependencies> </plugin>

你并不需要事件的annotationProcessors配置部分,因为maven-compiler-plugin可以自动发现和应用RequestFactory注释处理工具。

0

看起来这个问题发生在GWT应用程序从Eclipse或其他IDE启动时发生。在maven我没有看到它。

要解决这个问题的方法是开始使用Maven的应用程序来创建xxx.yyyDeobfuscatorBuilder类,然后你可以从Eclipse中启动您的GWT应用程序没有问题

+0

...或启用Eclipse中的批注处理 –

+0

@ThomasBroyer在我的情况下,批注处理总是在 –

+0

那样的话,混淆器应该生成构建器类(通常在'.apt_generated'目录中) –

相关问题