我正在使用最新的 gradle (6.8) 在 Azure DevOps 中运行构建,我得到了 NPE:
Caused by: java.lang.NullPointerException
at org.gradle.testing.jacoco.plugins.JacocoPluginExtension.applyTo(JacocoPluginExtension.java:162)
at org.gradle.testing.jacoco.plugins.JacocoPluginExtension$applyTo.call(Unknown Source)
at org.akhikhl.gretty.StartBaseTask.initJacoco(StartBaseTask.groovy:156)
at org.akhikhl.gretty.StartBaseTask.<init>(StartBaseTask.groovy:41)
at org.akhikhl.gretty.AppStartTask.<init>(AppStartTask.groovy)
at org.akhikhl.gretty.AppStartTask_Decorated.<init>(Unknown Source)
我在 build.gradle 有这样的配置:
buildscript {
repositories {
mavenCentral()
}
}
repositories {
mavenCentral()
}
apply plugin: 'java'
apply plugin: 'jacoco'
group = '*****'
version = '1.0-SNAPSHOT'
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
// my deps
}
test {
maxParallelForks = 1
finalizedBy jacocoTestReport
}
jacocoTestReport {
dependsOn test
}
jacoco {
toolVersion = "0.8.6"
}
我在 Azure DevOps 管道中有这样的配置:
- task: Gradle@2
displayName: 'Build and run unit tests'
inputs:
gradleWrapperFile: project-name/gradlew
workingDirectory: project-name
testResultsFiles: 'project-name/build/test-results/test/TEST-*.xml'
sonarQubeRunAnalysis: true
sonarQubeGradlePluginVersion: 2.6.2
任何想法为什么会发生?