[ACCEPTED]-How do I show the Maven POM hierarchy?-maven-2
There is no simple Maven command that will 41 show you the chain of parent POMs for a 40 pom.xml. The reason for this is that it 39 is not a common question one would typically 38 ask (more on that below). For your script, you'll 37 just have to parse the pom.xml file, get 36 the parent artifact coordinates, get a hold 35 of the artifact's pom.xml file and then 34 parse it's pom.xml file (and repeat). Sorry, but 33 there is no short cut I know of, but other folks have solved similar problems.
You 32 are right that technically the parent pom is a dependency 31 of your project, but it is not a literal 30 Maven Dependency and is handled completely 29 differently. The chain of parent poms, along 28 with active profiles, your
settings.xml file, and the 27 Maven super pom from the installation directory 26 are all combined together to create your 25 project's effective pom. The effective POM is what 24 Maven really uses to do its work. So basically, the 23 parent pom inheritance chain is already 22 resolved and combined before the dependency 21 plugin (or any other plugin) is even activated.
The 20 questions most people typically ask is 'what 19 does my REAL pom.xml really look like when Maven 18 is done combining everything?' or 'What 17 is the result my inheritance chain of parent 16 poms?' or 'How are my pom.xml properties 15 affected by an active profile?' The effective 14 pom will tell you all of this.
I know you 13 didn't ask, but for others reading this, if 12 you want to see your parent pom.xml, simply 11 open up the pom.xml in the M2Eclipse POM 10 editor and click on the parent artifact 9 link on the overview tab. In this way you 8 can quickly move up the chain of pom.xml 7 files with just a single click per pom. It 6 would be a strange project that had more 5 than 3 or 4 parent poms of inheritance.
If 4 you want to see your effective pom, you 3 can run the command
mvn help:effective-pom. Alternatively, you 2 can click on the Effective POM tab in M2Eclipse's 1 POM editor.
If your project defines version 3.1 or later 4 you can use:
The output looks similar to:
[INFO] Ancestor POMs: org.springframework.boot:spring-boot-starter-parent:1.4.0.RELEASE <- org.springframework.boot:spring-boot-dependencies:1.4.0.RELEASE
The 3 hierarchy-maven-plugin (that I wrote) can 2 display additional information about imported 1 poms like this :
[INFO] Displaying hierarchy. Set level=full to display dependencies in dependencyManagement [INFO] PARENT org.springframework.boot:spring-boot-samples:1.4.1.BUILD-SNAPSHOT [INFO] PARENT org.springframework.boot:spring-boot-starter-parent:1.4.1.BUILD-SNAPSHOT [INFO] PARENT org.springframework.boot:spring-boot-dependencies:1.4.1.BUILD-SNAPSHOT [INFO] IMPORT org.springframework:spring-framework-bom:4.3.3.BUILD-SNAPSHOT [INFO] IMPORT org.springframework.data:spring-data-releasetrain:Hopper-BUILD-SNAPSHOT [INFO] PARENT org.springframework.data.build:spring-data-build:1.8.4.BUILD-SNAPSHOT [INFO] IMPORT org.springframework.integration:spring-integration-bom:4.3.1.RELEASE [INFO] IMPORT org.springframework.security:spring-security-bom:4.1.3.RELEASE
Details are here : https://github.com/ExampleDriven/hierarchy-maven-plugin
More Related questions