Reputation:
Could somebody explain to me, what are are differences between the file pom.xml and the file effective pom.xml in an apache maven project?
Upvotes: 42
Views: 37018
Reputation: 4115
All Maven project POMs extend the Super POM, which defines a set of defaults shared by all projects.
All Maven POMs inherit defaults from the Super POM. If you are just writing a simple project that produces a JAR from some source in src/main/java, want to run your JUnit tests in src/test/java, and want to build a project site using mvn site, you don’t have to customize anything. All you would need, in this case, is the simplest possible POM shown in The Simplest POM. This POM defines a groupId, artifactId, and version: the three required coordinates for every project.
It is the merge between The Super POM
and the POM from The Simplest POM
.
NOTE: This info was extracted from the following link (in the link the explanation is very complete)
Upvotes: 52
Reputation: 15769
You can see the difference of a pom.xml and the effective pom.xml using
mvn help:effective-pom
which is describe here.
In a multi module project you'll use a parent pom.xml for defining general settings for all modules and then in each module there will only be specific settings.
The above goal will help you analyze the resulting pom that you could of course actually use instead of the parent reference.
The whole idea is by using the generalization (super-pom) / specialization (module pom) approach there is a central place where you can specify the general configuration. This is much more efficient then having to cut&paste the general parts.
Please also note that the effective pom will add the default behavior e.g. for the jar plugin so that you can debug issues like
with this approach. See also Maven `help:effective-pom` only generating for a single project, not all projects
Upvotes: 3