项目依赖依赖 spring-boot-stareter-parent 会自行设置 Option "-parameters" 相关参数,因为我没有直接使用spring-boot-stareter-parent ,需要自行配置一下其他的maven打包参数
JDK21 SpringBoot 3.4.3
I found this because Compile Option "-parameters" is disabled.
因为编译选项“-参数”被禁用。
-parameters
Generates metadata for reflection on method parameters. Stores formal parameter names of constructors and methods in the generated class file so that the method
java.lang.reflect.Executable.getParametersfrom the Reflection API can retrieve them.
为方法参数的反射生成元数据。在生成的类文件中存储构造函数和方法的正式参数名,以便来自反射API的方法java.lang.reflect.Executable.getParameters可以检索它们

先设置了<parameters>true</parameters>,运行aop报错,然后又设置了compilerArgs -parameters
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>21</source>
<target>21</target>
<encoding>UTF-8</encoding>
<parameters>true</parameters>
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
</configuration>
</plugin>
这可确保使用 -parameters 标志编译代码,从而使参数名称在运行时可用。
如果不使用父 pom,也可以在自己的pom中直接添加插件配置来配置
更新完成记得maven clean,然后重新编译运行,否则也是不生效的
我新增pom后找不到包,安装也下不下来