我有一个项目依赖于 hibernate-core
版本 5.2.x 和 5.3.x。
我想知道5.2.x从哪里来。
使用 dependencies
任务我只能看到依赖于 5.3.x 的库。
使用 dependencyInsight:
$ ./gradlew -q :mymodule:dependencyInsight --dependency hibernate-core --configuration compile
org.hibernate:hibernate-core:5.2.10.Final (selected by rule)
variant "runtime"
org.hibernate:hibernate-core:5.3.7.Final -> 5.2.10.Final
variant "runtime"
\--- org.springframework.boot:spring-boot-starter-data-jpa:2.1.0.RELEASE
+--- project :core
| \--- compile
\--- com.github.alturkovic.distributed-lock:distributed-lock-
jdbc:1.2.2
\--- project :core (*)
但是这里列出的两个软件包都依赖于 5.3,而不是 5.2。
那么我怎么知道这个版本来自哪里呢?
编辑:两个模块dependencyInsight
,没有--configuration
:
$ ./gradlew -q :moduleA:dependencyInsight --dependency hibernate-core
org.hibernate:hibernate-core:5.3.7.Final (selected by rule)
variant "default+runtime" [
Requested attributes not found in the selected variant:
org.gradle.usage = java-api
org.jetbrains.kotlin.platform.type = jvm
]
+--- compileClasspath
\--- org.springframework.boot:spring-boot-starter-data-jpa:2.1.0.RELEASE
+--- project :core
| \--- compileClasspath
\--- com.github.alturkovic.distributed-lock:distributed-lock-jdbc:1.2.2
\--- project :core (*)
(*) - dependencies omitted (listed previously)
A web-based, searchable dependency report is available by adding the --scan option.
$ ./gradlew -q :moduleB:dependencyInsight --dependency hibernate-core
org.hibernate:hibernate-core:5.3.7.Final
variant "runtime" [
Requested attributes not found in the selected variant:
org.gradle.usage = java-api
org.jetbrains.kotlin.platform.type = jvm
]
\--- org.springframework.boot:spring-boot-starter-data-jpa:2.1.0.RELEASE
+--- compileClasspath
\--- com.github.alturkovic.distributed-lock:distributed-lock-jdbc:1.2.2
\--- compileClasspath
(*) - dependencies omitted (listed previously)
A web-based, searchable dependency report is available by adding the --scan option.
最佳答案
这有点尴尬。
在我们的 gradle.properties
中,我们有:
hibernate.version=5.2.10.Final
我并没有意识到这一点。今天偶然发现的。
关于java - Gradle - 了解依赖项从何而来,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53535689/