首页 > 解决方案 > 警告:使用 OpenJDK 11 时发生非法反射访问操作

问题描述

我最近更新到 OpenJDK 11.0.9.1 2020-11-04,现在使用mvn clean.

这是警告:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

我正在使用 Spring Boot 2.4.0,我的 Maven 版本是:

Apache Maven 3.6.3
Maven home: /usr/share/maven
Java version: 11.0.9.1, vendor: Ubuntu, runtime: /usr/lib/jvm/java-11-openjdk-amd64
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.4.0-53-generic", arch: "amd64", family: "unix"

我的操作系统版本是 Ubuntu 20.04.1 LTS x86_64。

标签: javaspring-bootmavenopenjdk-11

解决方案


推荐阅读