2013-05-15 42 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'目錄中) –

相關問題