How to exclude specific dependencies from spring-boot-starter-parent

s4ik4t :

I am using a legacy Spring application and want to migrate to Spring Boot. My intention is to use the spring-boot-starter-data-jpa. For this reason I have added following section in pom.xml (which manages all spring-boot-dependencies):

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.3.RELEASE</version>
</parent>

But this is screwing up certain dependencies which I need to retain for time being. I am currently using Selenium dependencies (version 2.53.0; added transitively from another project) but spring-boot is fetching dependencies of 3.9.1.

I want to exclude 3.9.1 dependencies but the exclusion filter is not working as expected.

Just to summarize, I want to use spring-boot-starter-parent and spring-boot-starter-data-jpa but not the managed selenium-java from spring-boot-dependencies.

Appreciate any help in this regard.

M. Deinum :

Instead of messing around with <excludes> and then try to figure out what you need to include again (after figuring out what you excluded). Just override the version as explained here in the Spring Boot Reference Guide.

Assuming you are using the spring-boot-starter-parent as the parent you can just add a <selenium.version> to your <properties> section to specify which version you want.

<properties>
  <selenium.version>2.53.0</selenium.version>
</properties>

This will make Spring Boot use the version you want.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=85994&siteId=1