javavalidationgwtrequestfactorygwt-2.4

GWT, Maven and AspectJ: RequestFactory validation for AOPed code?


To use GWT 2.4.0 RequestFactory, you have to run request factory validation tool. Otherwise, it just won't work. [Google says][1], that it's enough just to add 2 plugins to 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>

The problem is, I have quite a complicated server-side code that uses AOP, so when validation tool is ran against that code, it fails because "there's no method xxx()", "class xxx doesn't implement interface yyy", etc.

So, my question is, is it possible to fix this issue on pom.xml level, rather then moving all AOP code into separate project that will be compiled separately?


Solution

  • Solved by moving all AOPed code to another project.