使用springBootVersion=2.0.5.RELEASE
时,我的项目测试为100%绿色/正常。
我将其升级到springBootVersion=2.0.6.RELEASE
后,某些测试失败了。
我再次将其降级为2.0.5.RELEASE
,并期望所有测试都是绿色的,但是即使使用./gradle clean build --no-daemon
,测试仍会失败。
怎么了?
我正在使用openjdk-11(oracle编译)。
我的gradle.properties:
theSourceCompatibility=1.8
kotlinVersion=1.2.71
springBootVersion=2.0.5.RELEASE
wrapper.gradleVersion=4.10.2
mockkVersion=1.8.9
我的build.gradle:
buildscript {
repositories {
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}"
classpath "org.jetbrains.kotlin:kotlin-allopen:${kotlinVersion}"
classpath 'org.jmailen.gradle:kotlinter-gradle:1.16.0'
classpath 'org.owasp:dependency-check-gradle:3.3.1'
}
}
apply plugin: 'kotlin'
apply plugin: 'kotlin-spring'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'org.jmailen.kotlinter'
apply plugin: 'org.owasp.dependencycheck'
apply from: 'versioning.gradle'
group = theGroup
version = getGitTag()
apply from: 'docker.gradle'
compileKotlin {
kotlinOptions {
freeCompilerArgs = ["-Xjsr305=strict"]
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
freeCompilerArgs = ["-Xjsr305=strict"]
jvmTarget = "1.8"
}
}
repositories {
jcenter()
}
dependencies {
compile 'org.springframework.boot:spring-boot-starter-actuator'
compile 'org.springframework.boot:spring-boot-starter-web'
compile 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
compile 'org.jetbrains.kotlin:kotlin-reflect'
testCompile "org.jetbrains.kotlin:kotlin-test"
testCompile "org.jetbrains.kotlin:kotlin-test-junit"
compile 'com.fasterxml.jackson.module:jackson-module-kotlin:2.9.3'
runtime 'org.springframework.boot:spring-boot-devtools'
compileOnly 'org.springframework.boot:spring-boot-configuration-processor'
testCompile 'org.springframework.boot:spring-boot-starter-test'
testCompile 'org.skyscreamer:jsonassert:1.5.0'
compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.6'
testImplementation "io.mockk:mockk:$mockkVersion"
//TODO: replace mockk line with the following one when we have kotlin 1.3
// testCompile "io.mockk:mockk:1.8.9.kotlin13"
// JUnit 5
testImplementation("org.junit.jupiter:junit-jupiter-api:5.2.0")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.2.0")
testRuntime("org.junit.platform:junit-platform-console:1.2.0")
}
compileKotlin { dependsOn formatKotlin }
defaultTasks 'clean', 'build'
wrapper { distributionType = Wrapper.DistributionType.ALL }