3

我正在以集中方式为多项目 gradle 构建配置依赖项版本。这样它的工作原理:

// root build.gradle.kts -- test configuration centralized
subprojects {

    apply(plugin = "java-library")

    repositories {
        jcenter()
    }

    val junitVersion = "5.5.2"

    dependencies {
        "testImplementation"(platform("org.junit:junit-bom:$junitVersion"))
    }
}

这种方式不行。虽然配置阶段是好的:

// root build.gradle.kts -- test && test fixtures configuration centralized
subprojects {

    apply(plugin = "java-library")

    repositories {
        jcenter()
    }

    val junitVersion = "5.5.2"

    dependencies {
        "testImplementation"(platform("org.junit:junit-bom:$junitVersion"))
    }

    if (convention.findPlugin(JavaTestFixturesPlugin::class.java) != null) {
        dependencies {
            "testFixturesApi"(platform("org.junit:junit-bom:$junitVersion"))
        }
    }
}

...但compileTestFixturesKotlin任务失败。错误是:

Could not find org.junit.jupiter:junit-jupiter-api:.

java-test-fixtures插件有什么问题?或者可能是我的代码?

4

0 回答 0