Search code examples
javaaspectjaspectj-maven-plugin

aspectj-maven-plugin compilanceLevel for java 10


I've been trying to to compile a project that relies on aspectJ-maven-plugin it works fine with the compilanceLevel 1.9(java 9) but when it comes to java 10 apparently it is not supported?

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)

its there anyway to workaround this?


Solution

  • I had this problem too. Since the ajc documentation is laughably out of date, I finally found the problem in the source code. For Java 10, you cannot use 1.10 for the compliance level, source, and target. You must use 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>