迁移到 Java 11 与 gradle;不支持的操作异常
尝试从 jdk 10 切换到 11,但无法确定哪个库调用此异常:
Caused by: org.gradle.api.GradleException: failed to read class file ../../SomeTestFile.class
...
...
Caused by: java.lang.UnsupportedOperationException
at org.objectweb.asm.ClassVisitor.visitNestMemberExperimental(ClassVisitor.java:248)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:651)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:391)
at org.gradle.api.internal.tasks.testing.detection.AbstractTestFrameworkDetector.classVisitor(AbstractTestFrameworkDetector.java:124)
我使用 gradle wrapper(v4.10.2) 和以下内容:build.gradle
buildscript {
ext {
springBootVersion = '2.0.5.RELEASE'
schemaDownloadVersion = '1.6'
generateAvroVersion = '0.14.2'
}
repositories {
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
maven { url "http://packages.confluent.io/maven/" }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath("gradle.plugin.com.amit.plugin.download-registry:registry-schema-download-plugin:${schemaDownloadVersion}")
classpath("com.commercehub.gradle.plugin:gradle-avro-plugin:${generateAvroVersion}")
}
}
apply plugin: 'java'
apply plugin: 'jacoco'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'com.amit.plugin.download-registry'
apply plugin: 'com.commercehub.gradle.plugin.avro'
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 11
repositories {
mavenCentral()
}
ext {
springCloudVersion = 'Finchley.RELEASE'
jaxbVersion = '2.3.0'
activationVersion = '1.1.1'
jmockitVersion = '1.43'
lombokVersion = '1.18.2'
}
jacoco {
toolVersion = '0.8.2'
}
dependencies {
compile('org.springframework.cloud:spring-cloud-starter-oauth2')
compile("javax.xml.bind:jaxb-api:${jaxbVersion}")
compile("com.sun.xml.bind:jaxb-core:${jaxbVersion}")
compile("com.sun.xml.bind:jaxb-impl:${jaxbVersion}")
compile("javax.activation:activation:${activationVersion}")
compileOnly("org.projectlombok:lombok:${lombokVersion}")
testCompile("org.jmockit:jmockit:${jmockitVersion}")
testCompile('org.springframework.boot:spring-boot-starter-test') {
exclude(group: 'org.mockito')
}
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
...
调查这个问题,我只知道gradle本身,lombok和jmockit使用库,这可能会导致这个异常。有人可以回答我哪个库调用这个异常吗?asm
更新
我发现那篇关于同样问题的文章:https://matsumana.info/blog/2018/09/25/gradle-with-jdk11/ 指向这里的gradle问题 https://github.com/gradle/gradle/issues/5120 所以这意味着gradle仍然不支持Java 11?