解决 maven编译项目-Fatal error compiling: 无效的目标发行版: 21 -> [Help 1]
目录
1. 问题描述
2. 排查思路
3. 设置-指定maven使用jdk21
4. 参考资料
1. 问题描述
在idea中使用maven编译时,在系统环境变量中已经设置了jdk为21,但是在执行mvn package时,确提示 Fatal error compiling: 无效的目标发行版: 21 -> [Help 1]
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.13.0:compile (default-compile) on project spring-ai-mcp-client: Fatal error compiling: 无效的目标发行版: 21 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.