【问题标题】:Kotlin 1.5.0 & Junit with 5.7.1/5.8.0-M1 FAILURE: Build failed with an exceptionKotlin 1.5.0 & Junit with 5.7.1/5.8.0-M1 FAILURE: Build failed with an exception
【发布时间】:2021-07-30 11:34:48
【问题描述】:

Gradle 7.0 和 Kotlin 1.5.0 运行 gradle @ 行:59-62。全部引用 'org.junit'。

testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.8.0-M1'
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.8.0-M1'
testCompile group: 'org.junit.vintage', name: 'junit-vintage-engine', version: '5.8.0-M1'
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: '5.8.0-M1'

结果:

gradle build clean

FAILURE:构建失败并出现异常。

  • 其中:构建文件 '/Users/NOTiFY/IdeaProjects/GoStopHandle/build.gradle' 行:59

  • 出了什么问题:评估根项目“GoStopHandle”时出现问题。

找不到参数 [{group=org.junit.jupiter, name=junit-jupiter-api, version=5.8.0-M1}] 的方法 testCompile() 在类型的对象上 org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler。

  • 尝试:使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。运行 --scan 以获得完整的见解。

  • 通过https://help.gradle.org获得更多帮助

此版本中使用了已弃用的 Gradle 功能,使其 与 Gradle 8.0 不兼容。使用 '--warning-mode all' 显示 个别弃用警告。看 https://docs.gradle.org/7.0/userguide/command_line_interface.html#sec:command_line_warnings

【问题讨论】:

  • 请出示完整的 Gradle 文件。

标签: java kotlin gradle junit5


【解决方案1】:

compiletestCompile 已弃用,应替换为 implementationtestImplementation

org.junit.jupiter:junit-jupiter-engine 具体应该使用testRuntimeOnly

【讨论】:

    猜你喜欢
    • 2018-10-27
    • 1970-01-01
    • 1970-01-01
    • 2018-10-05
    • 2023-01-21
    • 2019-06-11
    • 2021-02-01
    • 2018-03-03
    • 1970-01-01
    相关资源
    最近更新 更多