How to find a Maven dependency version declaration imported from a BOM

Marcel Stör picture Marcel Stör · Apr 19, 2016 · Viewed 13.3k times · Source

A multi-module parent POM declares the following BOM import:

<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>io.spring.platform</groupId>
      <artifactId>platform-bom</artifactId>
      <version>${spring.io.platform.version}</version>
      <type>pom</type>
      <scope>import</scope>
    </dependency>

Then a module POM declares a Hibernate dependency:

<dependency>
  <groupId>org.hibernate</groupId>
  <artifactId>hibernate-core</artifactId>
</dependency>

How do I find out with Maven command line or IntelliJ where the effective Hibernate version is defined?

Running mvn dependency:tree against my module yields:

...
[INFO] +- org.hibernate:hibernate-core:jar:4.3.11.Final:compile
...

which is not exactly helpful because it looks no different than if I managed the Hibernate version myself. If you have to do this manually you

  • start at platform-bom-2.0.3.RELEASE.pom, search for Hibernate -> nothing
  • go to its parent spring-boot-starter-parent-1.3.3.RELEASE.pom, search for Hibernate -> nothing
  • go to its parent spring-boot-dependencies-1.3.3.RELEASE.pom, search for Hibernate -> finally...

But what an ordeal. Of course you could check http://docs.spring.io/platform/docs/current/reference/htmlsingle/#appendix-dependency-versions but isn't that information Maven should be able to find on its own?

Answer

user2772346 picture user2772346 · Sep 28, 2019

mvn help:effective-pom -Dverbose=true gives the information of location of pom from where an entry comes in effective pom in comment. reference: http://maven.apache.org/plugins/maven-help-plugin/effective-pom-mojo.html