主要报错信息:
java.lang.IllegalArgumentException: Name for argument of type [java.lang.Integer] not specified, and parameter name information not available via reflection. Ensure that the compiler uses the ‘-parameters’ flag.
改bug过程:
在 pom.xml 文件的 标签内,配置 maven-compiler-plugin,添加 -parameters 选项,结果无用。
分析各个接口有无写错,改了几遍还是没用。
最终:编译版本不匹配
之前初始化项目时java选的版本是17,后来再pom.xml中改为了21。
但是maven-conmpiler-plugin中的版本还是17没改过去。
在 properties 中设置的 java.version 为 21 ,而 maven-compiler-plugin 配置的 和 是 17 。这种版本不匹配可能会导致编译过程出现问题,建议将它们统一。