gradle 找不到参数的方法testRuntime()[org.junit.jupiter:junit-jupiter-engine]

798qvoo8  于 2022-11-24  发布在  其他
关注(0)|答案(1)|浏览(195)

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.
6yt4nkrj

6yt4nkrj1#

更改为

testImplementation "org.junit.jupiter:junit-jupiter-engine"

相关问题