JDK 1.8。
分级7.3
在我的java项目中,我想用Kotlin编写单元测试。所以我尝试这样做:
在建筑中。Gradle:
plugins {
id 'application'
id "com.nocwriter.runsql" version "1.0.3"
id 'idea'
id "io.spring.dependency-management" version "1.0.11.RELEASE"
id 'org.jetbrains.kotlin.jvm' version '1.7.10'
}
apply plugin: "io.spring.dependency-management"
dependencies {
// The dependencies in the BOM will be dependency constraints in our build, but the versions in the BOM are forced for used dependencies.
implementation enforcedPlatform('org.springframework.boot:spring-boot-dependencies:2.7.2')
// Use dependency defined in BOM.
// Version is not needed, because the version defined in the BOM is a dependency constraint that is used.
implementation 'org.xerial:sqlite-jdbc'
implementation 'org.jetbrains.kotlin:kotlin-stdlib'
testImplementation(
'org.assertj:assertj-core',
'org.junit.jupiter:junit-jupiter-api'
)
testRuntime('org.junit.jupiter:junit-jupiter-engine')
// This version will be overridden by the one found in the BOM
implementation 'log4j:log4j:1.2.17'
implementation 'com.toedter:jcalendar:1.4'
}
用法:
./gradlew build
但是我在这一行中得到错误:
testRuntime('org.junit.jupiter:junit-jupiter-engine')
错误:
What went wrong:
A problem occurred evaluating project ':app'.
> Could not find method testRuntime() for arguments [org.junit.jupiter:junit-jupiter-engine] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
1条答案
按热度按时间6yt4nkrj1#
更改为