我正在将AspectJ 1.9.2与带有Java 8 Amazon Corretto的maven AspectJ插件1.11结合使用。我遇到的问题是,在编译一个特定模块时出现AJC编译器错误:
15:12:02,185 [ERROR] Failed to execute goal org.codehaus.mojo:aspectj-maven-plugin:1.11:compile (default) on project ui: AJC compiler errors:
15:12:02,186 [ERROR] abort ABORT -- (NoSuchMethodError) org.aspectj.util.LangUtil.is19VMOrGreater()Z
15:12:02,186 [ERROR] org.aspectj.util.LangUtil.is19VMOrGreater()Z
15:12:02,187 [ERROR] java.lang.NoSuchMethodError: org.aspectj.util.LangUtil.is19VMOrGreater()Z
我一直无法弄清楚为什么会发生此问题。我可以看到LangUtil确实包含is19VMOrGreater()方法。我看不到此错误的任何原因,也找不到与此有关的任何信息。如果我将AspectJ降级到1.8.9,我将不再看到此问题。可能是我正在使用的Java版本吗?
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${aspectj.version}</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>${maven.aspectj.version}</version>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${aspectj.version}</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
<configuration>
<complianceLevel>${java.version}</complianceLevel>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>