javacompilationdependenciesaspectjjava-17

After updating to java 17 started to receive [error] target level should be in '1.1'...'1.8','9'...'14': 17


I updating my test framework to use Java 17, using Gradle.

java {
    toolchain {
        languageVersion.set(JavaLanguageVersion.of(17))
    }
}

Also upgraded Gradle to '8.0.2' version. Trying to build project received

[error] target level should be in '1.1'...'1.8','9'...'14': 17

With some tips regarding AspectJ lib, that i dont understand (can be seen on the screenshot 1 attached). Screen 1

So i tried also update AspectJ plugin to the latest version id "io.freefair.aspectj.post-compile-weaving" version "8.0.1" in my build.gradle file. As a result AspectJ lib stopped to be seen by IDE(screenshot 2), enter image description here with

error: package org.aspectj.lang.annotation does not exist

Cant understand where to start digging and what this problem can be connected to? As a result i need to make my project work with Java 17, currently using 14 and AspectJ.


Solution

  • [error] target level should be in '1.1'...'1.8','9'...'14'
    

    This compiler error tells me that, according to the AspectJ Java version compatibility matrix, your AspectJ compiler is limited to max. Java 14, i.e. probably somewhere in your Gradle build, you have a dependency on org.aspectj:aspectjtools:1.9.6, where you would need at least 1.9.8. But like I said in my comment, simply go to the latest version 1.9.19. If I have some sparetime around Easter, maybe I can release 1.9.20 one of these days, but you will be fine with the current release.