2

A Multi-module project has modules with the following dependency: web->core->persistence

I added spring-boot-gradle-plugin to web module:

buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.3.RELEASE")
    }
 }
 apply plugin: 'spring-boot'

As spring-boot-gradle-plugin downloads old hibernate versions, i have duplicates in the persistence module.

Image

I tried to override hibernate dependencies in the web module and it's working:

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

Why does the plugin download old hibernate version? Is there any possibility to exclude old hibernate versions from spring-boot-gradle-plugin?

ValentinD
  • 33
  • 7

1 Answers1

0

First off, consider upgrading your plugin version to 1.5.9.RELEASE which is the current stable version. Also, consider using the Spring data jpa dependency which according to the documentation,

The spring-boot-starter-data-jpa POM provides a quick way to get started. It provides the following key dependencies:

  1. Hibernate — One of the most popular JPA implementations.
  2. Spring Data JPA — Makes it easy to implement JPA-based repositories.
  3. Spring ORMs — Core ORM support from the Spring Framework.

By default, Spring Boot uses Hibernate 5.0.x. However it’s also possible to use 4.3.x or 5.2.x if you wish. Please refer to the Hibernate 4 and Hibernate 5.2 samples to see how to do so.

You can find the link here. It also shows you how to override it to use more current versions in a maven project which isn't much different to what you've done.

Sammy65
  • 627
  • 2
  • 12
  • 28