java 10 的 aspectj-maven-plugin compilanceLevel

aspectj-maven-plugin compilanceLevel for java 10

我一直在尝试编译一个依赖于 aspectJ-maven-plugin 的项目,它在 compilanceLevel 1.9(java 9) 下工作正常,但当涉及到 java 10 时显然不支持?

ERROR]  Compliance options:
[ERROR]     -1.3               use 1.3 compliance (-source 1.3 -target 1.1)
[ERROR]     -1.4             + use 1.4 compliance (-source 1.3 -target 1.2)
[ERROR]     -1.5 -5 -5.0       use 1.5 compliance (-source 1.5 -target 1.5)
[ERROR]     -1.6 -6 -6.0       use 1.6 compliance (-source 1.6 -target 1.6)
[ERROR]     -1.7 -7 -7.0       use 1.7 compliance (-source 1.7 -target 1.7)
[ERROR]     -1.8 -8 -8.0       use 1.8 compliance (-source 1.8 -target 1.8)
[ERROR]     -1.9 -9 -9.0       use 1.9 compliance (-source 1.9 -target 1.9)
[ERROR]     -source <version>  set source level: 1.3 to 1.9 (or 6, 6.0, etc)
[ERROR]     -target <version>  set classfile target: 1.1 to 1.9 (or 6, 6.0, etc)

它有办法解决这个问题吗?

我也有这个问题。由于 ajc 文档已经过时了,我 终于 在源代码中找到了问题。对于 Java 10,您不能将 1.10 用于合规级别、来源和目标。你必须使用 10.

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>aspectj-maven-plugin</artifactId>
    <version>1.11</version>
    <configuration>
        <!-- MUST use 10, NOT 1.10 or ajc breaks -->
        <complianceLevel>10</complianceLevel>
        <source>10</source>
        <target>10</target>
    </configuration>
    ...
</plugin>