I'm working on a project in Maven and I'm trying to understand where certain settings are coming from in the effective pom. I want to trace backwards, so I can figure out which pom files need changing. I have modified my parent pom, my settings.xml file, and any other pom that seems to play a part, but the settings I want changed persist in the effective pom.
Is there a way to see where sections of the effective-pom come from? Or, can I at least see the "dependency" chain, if you will, of pom files that go into the effective pom?
Essentially I have a similar problem as this question: How to remove repositories from Effective POM but if there is a way to trace backwards that would really help me out.
Thanks!
This answer describes the various parts that create the effective POM.
You may try a variation of this answer to view the POM hierarchy (what you called the "dependency" chain). Add this config to the parent POM's <build><plugins>
section (temporarily?) to see it.
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>groovy-maven-plugin</artifactId>
<version>2.0</version>
<executions>
<execution>
<id>echo-build-environment</id>
<phase>validate</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<source>
<![CDATA[
log.info("POM Hierarchy")
def rootPom = project;
while (rootPom.parent != null) {
log.info(rootPom.groupId + ':' + rootPom.artifactId + ':' + rootPom.version)
rootPom = rootPom.parent;
}
log.info(rootPom.groupId + ':' + rootPom.artifactId + ':' + rootPom.version)
]]>
</source>
</configuration>
</execution>
</executions>
</plugin>
(Note, in pure Groovy the log.info lines above could be written as
"${rootPom.groupId}:${rootPom.artifactId}:${rootPom.version}"
Groovy calls these GString
s. I know the gmaven plugin handles GStrings a little differently than plain Groovy but don't have time to look up the details right now so used regular string concatenation in the example.)