gpt4 book ai didi

java - 为什么 hamcrest 在我的类(class)路径中?

转载 作者:行者123 更新时间:2023-11-30 08:32:48 25 4
gpt4 key购买 nike

我已经将 gradle 与 intellij 集成在一起,我似乎无法弄清楚为什么 hamcrest 库在我的类路径中,即使它没有在 build.gradle 中列出。

enter image description here

最佳答案

因为 junit:junit:4.12 将其作为传递依赖引入。你可以通过运行看到这一点

./gradlew dependencies

这是 jUnit 文档中的相关部分

There is nothing extra that needs to be done in order to use a specific artifact of Hamcrest. In the past, there were two JUnit Maven artifacts: junit:junit and junit:junit-dep, where the latter version did not include a bundled copy of org.hamcrest:hamcrest-core and instead declared a transitive dependency on Hamcrest. In order to be more Maven-like, starting in version 4.11, there is only the junit:junit artifact which uses a transitive dependency on hamcrest-core.

https://github.com/junit-team/junit4/wiki/Use-with-Gradle

关于java - 为什么 hamcrest 在我的类(class)路径中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39859603/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com