I had not developed Java in 10 years and needed to quickly compile a plugin project written with Java 8 features. I downloaded the latest JDK (AdoptOpenJDK 16) and installed it on my MacOS development machine.
Looking at the POM file for the project, I saw these two settings:
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
and read that these settings would tip the compiler that the code was written with Java 8 features and the compiled classes need to be compatible with the 1.8 JVM.
I followed the developer instructions yet encountered errors:
Upon initial build, the following error would stop the build :
[ERROR] import: Entry[import from realm ClassRealm[project>org.github.flytreeleft:nexus3-keycloak-plugin:0.5.0-SNAPSHOT, parent: ClassRealm[maven.api, parent: null]]]
[ERROR]
[ERROR] -----------------------------------------------------
[ERROR] : begin 0, end 3, length 2
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
Similar people encountered the same issue on other projects. Ultimately I used a workaround that was suggested to skip the maven Enforcer to get past this error.
Upon rebuild, the project and would fail with about 90 compile errors in various files. The messages would say something similar to:
String cannot be resolved to a type
Which led me to this SO questions that had a similar error ... but no good answers.
How do I get this project to build?