JDK编译版本的错误
又有一个新项目接手运行时正常的没有报错但是编译却出错了。这个项目是JDK11的项目不知道为什么用Idea打包的时候却使用了JDK8。问了一下AI。在pom.xml中加上plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-compiler-plugin/artifactId version3.10.1/version !-- JDK 11 推荐用 3.8 版本 -- configuration !-- 统一为 JDK 11消除版本不匹配警告 -- release11/release encodingUTF-8/encoding !-- 可选关闭严格泛型检查避免额外报错 -- compilerArgs arg-Xlint:-unchecked/arg /compilerArgs /configuration /plugin就可以正常编译了