我有一个具有以下依赖项的gradle项目:
dependencies {
compile("com.googlecode.json-simple:json-simple:1.1.1")
compile("org.hibernate:hibernate-c3p0:5.2.12.Final")
compile("mysql:mysql-connector-java:5.1.44")
compile("org.springframework.boot:spring-boot-starter-aop")
compile("org.springframework.boot:spring-boot-starter-web")
compile group: 'org.springframework.boot', name: 'spring-boot-starter-log4j2'
}
并具有以下应用spring boot插件:
apply plugin: 'org.springframework.boot'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.9.RELEASE")
}
}
我遇到的问题是,当我包含spring boot插件时,旧版本的hibernate-core似乎被导入到我的项目中(5.0.12.Final) . 但我的代码使用5.2.12.Final hibernate-core库 .
我无法理解为什么hibernate核心库带有spring boot插件,因为我看不到它在maven central的依赖关系中列出,但是当我删除了这个依赖时,旧版本的hibernate似乎消失了 .
我在尝试声明依赖项时尝试排除模块,但在buildscript部分中排除时似乎没有语法正确 .
有没有其他人有这个问题?是否有任何解决方法可以排除该版本?或者也许我的设置在一起是错误的..任何帮助将不胜感激:)
1 回答
经过多次研究后终于想出了这个问题/看起来很明显现在经过一些研究,问题是由于 Spring 季靴子自己的依赖管理,所以我所要做的就是指定我想要使用的特定模块的版本(如果是 Spring 天引导已经包括它),它工作了!这是我添加到build.xml文件中的内容