我有一个 gradle FAILURE:
..."Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0."
案例描述:
- 附加到项目代码库的下一个库:
APP/build.gradle
//(Required) Writing and executing Unit Tests on the JUnit Platform
testImplementation "org.junit.jupiter:junit-jupiter-api:5.2.0"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.2.0"
// (Optional) If you need "Parameterized Tests"
testImplementation "org.junit.jupiter:junit-jupiter-params:5.2.0"
// (Optional) If you also have JUnit 4-based tests
testImplementation "junit:junit:4.12"
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:5.2.0"
testImplementation "io.mockk:mockk:1.8.5"
- 更新了 gradle-wrapper.properties
distributionUrl=https….gradle- 4.4-all .zip 到 4.7-all
在所有的 gradle 都建立成功之后
创建了测试课程
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class TestClass {
@Test
internal fun testName() {
Assert.assertEquals(2, 1 + 1)
}
}
结果,我无法构建应用程序,并且收到了 FAILURE: 消息。
原文由 Philipp Buhaievskiy 发布,翻译遵循 CC BY-SA 4.0 许可协议
使用命令行参数
--warning-mode=all
运行 Gradle 构建,以查看已弃用的功能到底是什么。它将通过指向 Gradle 文档的链接为您详细描述发现的问题,以获取有关如何修复构建的说明。
添加
--stacktrace
至此,如果警告是由其中一个插件中的过时代码而不是您的构建脚本触发的,您还可以查明警告的来源。