我一直在尝试编译一个依赖于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>