diff --git a/notes/构建工具.md b/notes/构建工具.md index 24f2f9ba..58ab12f2 100644 --- a/notes/构建工具.md +++ b/notes/构建工具.md @@ -41,7 +41,7 @@ Gradle 和 Maven 的区别是,Gradle 的构建脚本用基于 Groovy 或 Kotli junit junit - 4.10 + 4.12 test @@ -60,7 +60,7 @@ repositories { } dependencies { - testImplementation "junit:junit:4.10" + testImplementation "junit:junit:4.12" } ``` @@ -155,15 +155,22 @@ demo:a:pom:1.0 只写 dependencies 一段时,脚本求值失败: ```text -> Could not find method testImplementation() for arguments [junit:junit:4.10] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler. +> Could not find method testImplementation() for arguments [junit:junit:4.12] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler. +``` + +只加 plugins、不写 repositories 时,依赖解析失败(命令同下): + +```text +testRuntimeClasspath - Runtime classpath of source set 'test'. +\--- junit:junit:4.12 FAILED ``` 加上 plugins 和 repositories 后,`gradle -q dependencies --configuration testRuntimeClasspath` 的输出: ```text testRuntimeClasspath - Runtime classpath of source set 'test'. -\--- junit:junit:4.10 - \--- org.hamcrest:hamcrest-core:1.1 +\--- junit:junit:4.12 + \--- org.hamcrest:hamcrest-core:1.3 ``` ## 参考资料