Recently upgraded my code to java 17. Earlier I was using MapStruct 1.3.1 with Java 11.
So, let me tell/show you the three scenarios.
So now after java 17 update when I run my test case (say MyTestMethod
) with the run button in IntelliJ
It throws this error -
java: Supported source version 'RELEASE_6' from annotation processor 'org.mapstruct.ap.MappingProcessor' less than -source '17'
But if I run the same test case with this command -
mvn test -Dtest="MyTestClass#MyTestMethod"
Its a SUCCESS
However If I change the version of MapStruct to 1.5.5.final SCENARIO 1 starts working correctly.
My questions now -
I was able to solve this in intellij by adding this in compiler settings
-Djps.track.ap.dependencies=false
like shown in the picture