GWT,Maven和AspectJ:AOPed代码的RequestFactory验证?

时间:2011-10-02 08:37:50

标签: java validation gwt requestfactory gwt-2.4

要使用GWT 2.4.0 RequestFactory,您必须运行请求工厂验证工具。否则,它就行不通。 [谷歌说] [1],只需将2个插件添加到pom.xml即可:

  <!-- requestfactory-apt runs an annotation processor (APT) to
       instrument its service interfaces so that
       RequestFactoryServer can decode client requests. Normally
       you would just have a dependency on requestfactory-apt
       with <scope>provided</scope>, but that won't work in
       eclipse due to m2e bug
       https://bugs.eclipse.org/bugs/show_bug.cgi?id=335036 -->
  <plugin>
    <groupId>org.bsc.maven</groupId>
    <artifactId>maven-processor-plugin</artifactId>
    <version>2.0.5</version>
    <executions>
      <execution>
        <id>process</id>
        <goals>
          <goal>process</goal>
        </goals>
        <phase>generate-sources</phase>
      </execution>
    </executions>
    <dependencies>
      <dependency>
        <groupId>com.google.web.bindery</groupId>
        <artifactId>requestfactory-apt</artifactId>
        <version>${gwtVersion}</version>
      </dependency>
    </dependencies>
  </plugin>

  <!-- Google Plugin for Eclipse (GPE) won't see the source
       generated above by requestfactory-apt unless it is exposed
       as an additional source dir-->
  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>build-helper-maven-plugin</artifactId>
    <version>1.7</version>
    <executions>
      <execution>
        <id>add-source</id>
        <phase>generate-sources</phase>
        <goals>
          <goal>add-source</goal>
        </goals>
        <configuration>
          <sources>
            <source>${project.build.directory}/generated-sources/apt</source>
          </sources>
        </configuration>
      </execution>
    </executions>
  </plugin>

问题是,我有一个使用AOP的相当复杂的服务器端代码,因此当针对该代码运行验证工具时,它失败,因为“没有方法xxx()”,“类xxx没有实现接口yyy“等等。

所以,我的问题是,是否可以在pom.xml级别修复此问题,而不是将所有AOP代码移动到将单独编译的单独项目中?

1 个答案:

答案 0 :(得分:-2)

通过将所有AOPed代码移动到另一个项目来解决。