Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I know the version of a transitive dependency that a Spring Boot starter dependency brings into my project?

Tags:

spring-boot

For example, how do I find out the version of Hibernate that the Spring Boot spring-boot-starter-data-jpa starter dependency is bringing into my project?

like image 262
Anonymous Human Avatar asked Dec 04 '16 17:12

Anonymous Human


People also ask

How do you identify transitive dependencies?

A transitive dependency occurs when one non-prime attribute is dependent on another non-prime attribute. If a table schema contains a dependency , where and are non-prime attributes, we say it contains a transitive dependency from to .

What is transitive dependency in spring boot?

transitive dependency that is managed by the parent POM, just add a. version property for that dependency. For this rule to work the parent. POM has to define version properties for all the dependencies that it. manages (the spring-boot-starter-parent does this).

Which is the correct starter dependency for spring boot?

Now Spring Boot Starters provides all those with just a single dependency. The official starters follow a naming convention spring-boot-starter-*, where * denotes application type. For example, if we want to build web including RESTful applications using Spring MVC we have to use spring-boot-starter-web dependency.

How do you find the parent of transitive dependency?

If you've not declared a dependency in your pom. xml, but it's appearing in your project, it's being imported somewhere as a transitive dependency. You can see exactly which dependency is importing it, by looking at the dependency:tree report, and walking back up the “tree” to find its parent.


3 Answers

The list of dependencies is available in the Appendix F. of the documentation and in the pom.xml of the spring-boot-dependencies artifact, which you should be able to find on your classpath.

You can also go the public repository of Spring Boot and see the pom.xml for every released version in a separate branch.

like image 151
Daniel Olszewski Avatar answered Sep 21 '22 19:09

Daniel Olszewski


When using maven, use the below command to print dependency tree

mvn dependency:tree

http://maven.apache.org/plugins/maven-dependency-plugin/examples/resolving-conflicts-using-the-dependency-tree.html

When using gradle:

gradlew dependencies

dependencies - Displays all dependencies declared in root project 'my-project'.

dependencyInsight - Displays the insight into a specific dependency in root project 'my-project'.

Also, an IDE shows this information in some window. For example, IntelliJ shows all project dependencies in the project window under 'External Libraries' and in the maven window.

like image 32
Yuva Avatar answered Sep 18 '22 19:09

Yuva


To supplement Yuva's answer, if you are looking for hibernate's version, you may run

gradle dependencyInsight --dependency hibernate --configuration compile

or if your project is structured as a multi-project, under project root run

gradle submodule:dependencyInsight --dependency hibernate --configuration compile

The command gives result for what depends on hibernate in this project whereas gradle dependencies gives result for what dependencies this project have

like image 20
user2829759 Avatar answered Sep 21 '22 19:09

user2829759