elvis
elvis

Reputation: 1178

How to check for another dependency version in the maven pom.xml in a Spring Boot project?

A dependency in the pom.xml needs another dependency that doesn't exist: org.springframework.cloud:spring-cloud-starter-kubernetes-ribbon:jar:1.1.2.RELEASE

How can I do in the pom, when this 1.1.2 version is checked, to get the 1.1.1 version? So when something is checking for 1.1.2 version, to check for 1.1.1 version.

Thank you in advance!

Upvotes: 0

Views: 1220

Answers (2)

rns
rns

Reputation: 1091

Other option than what @Pratapi Hemant Patel has suggested, you can go to Dependency Hierarchy tab in pom.xml in eclipse and search for spring-cloud-starter-kubernetes-ribbon in filter text box and exclude it explicitly if not needed.

One benefit of it would be you would know which artifacts has dependency on 1.1.2 version. And also if 1.1.1 is overridden by 1.1.2 version. Basically you will get all artifacts that has dependency on 1.1.2 and also 1.1.1 version. Below is image of same.

senter image description here

Upvotes: 1

Hemant Patel
Hemant Patel

Reputation: 3260

You can enforce to use specific version of a transitive dependency using dependency management.

<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-starter-kubernetes-ribbon</artifactId>
      <version>1.1.1.RELEASE</version>
    </dependency>
  </dependencies>
</dependencyManagement>

Now only the specified version will be used. Not the versions declared in transitive dependencies.

Upvotes: 2

Related Questions