GWT、Maven 和 AspectJ:AOP 代码的 RequestFactory 验证?

发布于 2024-12-07 18:39:15 字数 2288 浏览 0 评论 0原文

要使用 GWT 2.4.0 RequestFactory,您必须运行请求工厂验证工具。否则,它就行不通。 [Google 说][1],只需向 pom.xml 添加 2 个插件就足够了:

  <!-- 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 代码移至单独的项目会单独编译吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

破晓 2024-12-14 18:39:15

通过将所有 AOP 代码移至另一个项目来解决。

Solved by moving all AOPed code to another project.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文