jdk1.8升级jdk17,build.gradle的变化

应公司要求,需将jdk1.8升级到jdk17版本,在升级过程中遇到的坑以及解决方案记录如下:

问题 解决方案
class jdk.internal.loader.ClassLoaders P l a t f o r m C l a s s L o a d e r c a n n o t b e c a s t t o c l a s s j a v a . n e t . U R L C l a s s L o a d e r ( j d k . i n t e r n a l . l o a d e r . C l a s s L o a d e r s PlatformClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders PlatformClassLoadercannotbecasttoclassjava.net.URLClassLoader(jdk.internal.loader.ClassLoadersPlatformClassLoader and java.net.URLClassLoader are in module java.base of loader ‘bootstrap’) gradle版本和jdk版本不匹配,升级gradle版本 7.5 以上
Could not find method compile() compile替换成implementation;
testCompile替换成testImplementation
Gradle7以上默认不支持http的maven库 maven {
allowInsecureProtocol true
url ‘http://artifactory.saicm.local/artifactory/maven-virtual/’
}
java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not “opens java.lang” to unnamed module @cc43f62 添加VM参数 --add-opens java.base/java.lang=ALL-UNNAMED
–add-opens java.base/java.util=ALL-UNNAMED
遇到的具体依赖的问题 升级到最新版本
lombok 1.18.20
easyexcel 3.2.1
druid-spring-boot-starter:1.2.9
com.ctrip.framework.apollo.apollo-client:2.0.0

你可能感兴趣的:(java,开发语言)