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

后端 未结 6 1899
面向向阳花
面向向阳花 2021-02-08 05:18

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


  
    
      io.s         


        
相关标签:
6条回答
  • 2021-02-08 05:44

    According to How do I show the Maven POM hierarchy? it looks like it not possible with a simple command.

    You should write your own plugin or script to climb the hierarchy to the top and find the artifact you are interested in.

    Small Tip: to retrieve the version of an artifact you're using, you can open the pom.xml in the Idea Editor and hold Ctrl while hovering on the artifactId, and the full name of its pom will be displayed, with its version.

    0 讨论(0)
  • 2021-02-08 05:45

    My answer would be really similar to @Didier L. I was getting error due to the .xml file extension mvn org.apache.maven.plugins:maven-help-plugin:3.2.0:effective-pom -Dverbose=true -Doutput=effective-pom

    0 讨论(0)
  • 2021-02-08 05:47

    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

    0 讨论(0)
  • 2021-02-08 06:00

    I was trying to use mvn help:effective-pom -Dverbose from this other answer, but it didn't work for me because it was using maven-help-plugin:2.2, and -Dverbose was introduced in 3.2.0.

    Instead, you should thus force the version in the command line:

    mvn org.apache.maven.plugins:maven-help-plugin:3.2.0:effective-pom -Dverbose=true -Doutput=effective-pom.xml
    

    (better to use -Doutput because the file can be big and it is not convenient to read it in a terminal)

    0 讨论(0)
  • 2021-02-08 06:02

    In Eclipse, when viewing the pom in XML format (i.e in the "pom.xml" tab, not the "Overview" tab), simply put the mouse cursor over the artifact name and a popup will appear with the effective version and the location where it is defined.

    0 讨论(0)
  • 2021-02-08 06:02

    There are two things. First the output of dependency:tree prints out what the final result is. The question here is why you don't believe it? And why do you manage the version yourself if you are using a BOM...

    Apart from that you could use:

    mvn help:effective-pom
    

    And if you search a little bit better than you will come to the following pom file which contains the version definition like this:

    <hazelcast.version>3.5.5</hazelcast.version>
    <hibernate.version>4.3.11.Final</hibernate.version>
    <hibernate-validator.version>5.2.4.Final</hibernate-validator.version>
    <hikaricp.version>2.4.3</hikaricp.version>
    <hikaricp-java6.version>2.3.13</hikaricp-java6.version>
    <hornetq.version>2.4.7.Final</hornetq.version> 
    

    which are exactly the version which is printed out already by dependency:tree.

    0 讨论(0)
提交回复
热议问题