多模块项目包含具有以下依赖关系的模块: web->core->persistence
我在web模块中添加了spring-boot-gradle-plugin:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.3.RELEASE")
}
}
apply plugin: 'spring-boot'当spring-boot-gradle-plugin下载旧的hibernate版本时,我在持久性模块中有了副本。
Image
我试图覆盖web模块中的hibernate依赖关系,并且它正在工作:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.3.RELEASE")
}
}
apply plugin: 'spring-boot'
dependencies {
compile project(':core')
//Other dependencies
compile "org.hibernate:hibernate-core:${hibernateVersion}"
compile "org.hibernate:hibernate-validator:${hibernateValidatorVersion}"
compile "org.hibernate:hibernate-entitymanager:${hibernateVersion}"
}Image
为什么插件要下载旧的hibernate版本?有没有可能从spring-boot-gradle-plugin中排除旧的hibernate版本?
发布于 2018-01-04 23:22:26
首先,考虑将您的插件版本升级到1.5.9.RELEASE,这是当前稳定的版本。另外,考虑使用Spring data jpa依赖项,根据文档,
spring-boot-starter-data-jpa POM提供了一种快速入门的方法。它提供了以下关键依赖项:
默认情况下,Spring Boot使用Hibernate 5.0.x。但是,如果您愿意,也可以使用4.3.x或5.2.x。请参考Hibernate 4和Hibernate 5.2示例以了解如何做到这一点。
您可以找到链接here。它还向您展示了如何覆盖它,以便在maven项目中使用更新的版本,这与您所做的没有太大不同。
https://stackoverflow.com/questions/35683301
复制相似问题