Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Boot: The managed version is 1.3.2.RELEASE The artifact is managed in org.springframework.boot:spring-boot-dependencies:1.3.2.RELEASE

I create a skeleton application use Spring boot. This is my pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.lynas</groupId>
    <artifactId>SpringMVCHibernate</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>

    <name>SpringMVCHibernate</name>
    <description>SpringMVCHibernate</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.3.2.RELEASE</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.16.6</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>5.1.0.Final</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>


</project>

I stuck at this step:

Spring Boot: The managed version is 1.3.2.RELEASE The artifact is managed in org.springframework.boot:spring-boot-dependencies:1.3.2.RELEASE

enter image description here

When I try add Hiberante 5.1.0.Final manually, this notice appear:

Overriding managed version 4.3.11.Final for hibernate-core

enter image description here

Help me resolve these problem.

like image 963
Do Nhu Vy Avatar asked Feb 13 '16 13:02

Do Nhu Vy


People also ask

Which version of Spring does spring boot 2.4 use?

Spring Boot 2.4 uses Spring Framework 5.3.

How do I override Jackson Databind version in spring boot?

Adding jackson-bom. version to your properties section of the pom. xml file should update jackson dependencies. This will override jackson version in the Spring Boot Parent POM.

What is artifact in spring boot?

Artifact: project coordinates (id of the artifact, as referred by the artifactId attribute in Apache Maven). Also infers the name of the project. Name: display name of the project that also determines the name of your Spring Boot application.

What is spring boot version management?

Spring Boot manages dependencies and configuration automatically. Each release of Spring Boot provides a list of dependencies that it supports. The list of dependencies is available as a part of the Bills of Materials (spring-boot-dependencies) that can be used with Maven.


2 Answers

Spring Boot provides dependency management for Hibernate. The warning is Eclipse telling you that you've overridden this dependency management by declaring a version directly on a dependency. That's a risky thing to do as you may end up with a mixture of Hibernate versions on the classpath. In fact, looking at your pom, you've overridden the version of hibernate-core but not of hibernate-entitymanager. This means you'll have 5.1.0.Final of the former and 4.3.11.Final of the latter on the classpath. That will almost certainly lead to problems at runtime.

A safer way to use Hibernate 5 is to override Boot's dependency management. As you are using spring-boot-starter-parent as your pom's parent you can do that by overriding the hibernate.version property:

<properties>
    <hibernate.version>5.1.0.Final</hibernate.version>
</properties>

This will ensure that all Hibernate modules for which Spring Boot provides dependency management will have the desired version.

Finally, a note of caution. Hibernate 5.1 is very new and contains some breaking changes, even from 5.0.x. As a result, you may run into some incompatibility problems. If you don't want to be right on the bleeding edge, 5.0.x may be a safer choice. It will become the default Hibernate version in Spring Boot 1.4.

like image 161
Andy Wilkinson Avatar answered Sep 30 '22 14:09

Andy Wilkinson


Spring Boot automatically defines version for dependencies as listed in this appendix. http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#appendix-dependency-versions

Eclipse is just reminding about it. You can ignore the warning if you really want to change the version for that dependency.

Update:

See Andy's answer: https://stackoverflow.com/a/35385268/1433665

like image 24
TheKojuEffect Avatar answered Sep 30 '22 16:09

TheKojuEffect