aspectj-maven-plugin compilanceLevel for java 10
Asked Answered
D

1

7

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?

Desdamonna answered 18/6, 2018 at 9:56 Comment(1)
Where is your code? What is your concrete problem? What does not compile under Java 10 with language level 9? Why do you need language level 10?Snafu
C
16

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>
Condemnation answered 26/7, 2018 at 13:55 Comment(2)
The new documentation is present here - mojohaus.org/aspectj-maven-plugin/…Unicorn
I have a similar issue with 1.8 and this actually let me build using Maven. I did not get this error using IntelliJ.Makowski

© 2022 - 2024 — McMap. All rights reserved.