Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to override Spring Boot dependencies default version?

How to change Spring Boot dependencies default versions? For example Spring Boot 1.4 uses Thymeleaf 2.1 version but recent version of Thymeleaf is 3.0. So how to change version 2.1 to 3.0?

like image 733
samadadi Avatar asked Sep 21 '16 10:09

samadadi


People also ask

How do I override a dependency version?

Overriding Solved Dependency Versions By taking advantage of Maven's nearest definition logic, developers can override the version of a dependency by declaring it on the root pom. xml file. The example below shows an overridden version for checker-qual and how it was managed by Maven.

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.

How do I exclude a specific version of a dependency in Maven?

Multiple transitive dependencies can be excluded by using the <exclusion> tag for each of the dependency you want to exclude and placing all these exclusion tags inside the <exclusions> tag in pom. xml. You will need to mention the group id and artifact id of the dependency you wish to exclude in the exclusion tag.

What is default dependency in spring boot?

Spring Boot Starter Parent defines spring-boot-dependencies as a parent pom. It inherits dependency management from spring-boot-dependencies. The properties section defines the application default values. The default Java version is 1.8.


2 Answers

The documentation describes how to do this.

Judging by the tags on the question, you're using Maven. You should add a property to your application's pom.xml to set the Thymeleaf version:

<properties>
    <thymeleaf.version>3.0.1.RELEASE</thymeleaf.version>
</properties>

There's also a sample application that shows how to use Thymeleaf 3.0 with Spring Boot 1.4 that may be of interest.

like image 199
Andy Wilkinson Avatar answered Oct 05 '22 12:10

Andy Wilkinson


The answer provided by Andy only works when your POM inherits from spring-boot-dependencies. When spring-boot-dependencies is added through dependencyManagement, you have to redefine all the artifacts that you want to override. Bummer!

This is also stated in the document referenced by Andy (it might have been added later).

like image 28
rwfbc Avatar answered Oct 05 '22 11:10

rwfbc