The effective POM

The pom a project keeps is short because most of a Maven project is not written down anywhere: the folders, the plugin versions, the executions of every phase and the central repository come from Maven itself and from the poms a project inherits. What Maven builds from all of it is the effective pom, and there is a command that prints it. When a build does something the pom does not mention, this is the document that explains it.

The model Maven builds

Three steps turn the file on disk into the model of a build. Maven reads the pom, then the parent it names, then the parent of that one, up to the super POM that ships inside Maven itself. It merges the properties, the dependencies and the plugins of all of them, a child wins over a parent. Then it replaces every ${...} with its value, and applies the profiles that are active for this run.

The super POM is why a project with thirty lines of pom still has a maven-clean-plugin of a known version and a central repository. It is not in the project; it is in $MAVEN_HOME/lib/maven-model-builder-3.9.16.jar, in a file called pom-4.0.0.xml.

The project of this page is the one of the coordinates article: a jar, one class, no dependencies.

pom.xml

<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.example.store</groupId> <artifactId>coords</artifactId> <version>2.3.1</version> <packaging>jar</packaging> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.release>21</maven.compiler.release> </properties> </project>

src/main/java/com/example/coords/Coords.java

package com.example.coords; public class Coords { public static void main(String[] args) { System.out.println("2.3.1"); } }

help:effective-pom

The help plugin has a goal for it. Run from the project folder, it prints the model to the console, log lines and all:

mvn -B help:effective-pom > build.log 2>&1; echo "status: $?"; sed "s#$PWD#<project>#g" build.log

The whole output is 249 lines, and most of it is the nine plugins of the jar lifecycle with every execution spelled out. Printing it here would bury the four parts worth reading, so the block below is a trimmed excerpt: it keeps the header, the coordinates, the properties, the repositories, the build directories and the compiler plugin, and it skips everything between them. The lines are unchanged and in the order of the run; only whole lines were removed.

An excerpt of the output

[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< com.example.store:coords >----------------------
[INFO] Building coords 2.3.1
[INFO] from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- help:3.6.0:effective-pom (default-cli) @ coords ---
[INFO]
Effective POMs, after inheritance, interpolation, and profiles are applied:

<?xml version="1.0" encoding="UTF-8"?>
<!-- ====================================================================== -->
<!-- -->
<!-- Effective POM for project 'com.example.store:coords:jar:2.3.1' -->
<!-- -->
<!-- ====================================================================== -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example.store</groupId>
  <artifactId>coords</artifactId>
  <version>2.3.1</version>
  <properties>
    <maven.compiler.release>21</maven.compiler.release>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  <repositories>
    <repository>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <id>central</id>
      <name>Central Repository</name>
      <url>https://repo.maven.apache.org/maven2</url>
    </repository>
  </repositories>
  <build>
    <sourceDirectory><project>/src/main/java</sourceDirectory>
    <scriptSourceDirectory><project>/src/main/scripts</scriptSourceDirectory>
    <testSourceDirectory><project>/src/test/java</testSourceDirectory>
    <outputDirectory><project>/target/classes</outputDirectory>
    <testOutputDirectory><project>/target/test-classes</testOutputDirectory>
    <resources>
      <resource>
        <directory><project>/src/main/resources</directory>
      </resource>
    </resources>
    <testResources>
      <testResource>
        <directory><project>/src/test/resources</directory>
      </testResource>
    </testResources>
    <directory><project>/target</directory>
    <finalName>coords-2.3.1</finalName>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.15.0</version>
        <executions>
          <execution>
            <id>default-compile</id>
            <phase>compile</phase>
            <goals>
              <goal>compile</goal>
            </goals>
          </execution>
          <execution>
            <id>default-testCompile</id>
            <phase>test-compile</phase>
            <goals>
              <goal>testCompile</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.099 s
[INFO] Finished at: 2026-11-22T08:35:33Z
[INFO] ------------------------------------------------------------------------

Four things in it are worth the read. The coordinates are the ones of the pom, and the comment above them names the packaging and the version the model has: 'com.example.store:coords:jar:2.3.1'. The repositories are not in the pom at all: central comes from the super POM, and it is the repository the offline failure of the first project names.

The build section turns the layout into absolute paths: <sourceDirectory>, <outputDirectory>, <finalName>. Every one of them is a default that a pom can override, and every one is what the layout article described in words.

The plugins are the interesting part. Each of the nine has a version and a list of executions, and each execution has an id, a phase and a goal. This is where maven-compiler-plugin 3.15.0 with default-compile in the phase compile and default-testCompile in the phase test-compile comes from, and the lifecycle article reads the map of phases and executions in full.

A version in the effective pom is the version a build uses, but not always the version Maven itself would pick: the archetype project pins other versions in pluginManagement, and its effective pom shows the pinned ones. The pins are merged before anything runs, so the document is the truth of the build and the pom is only its first page.

Where the rest comes from

Three sources fill in what the pom leaves out, and they are worth keeping apart:

Writing it to a file

-Doutput writes the document to a file instead of the console, which is how a build can keep the model it used:

mvn -B help:effective-pom -Doutput=effective-pom.xml > out.log 2>&1; echo "status: $?"; wc -l effective-pom.xml

status: 0
238 effective-pom.xml

Two hundred and thirty-eight lines for a pom of sixteen: that is what Maven adds. The file is not part of the project and nothing reads it back; it is a snapshot for a person, and it is the first thing to attach to a question about a build that behaves differently from the pom.

Where to go next

The lifecycle article takes the executions this document lists and follows them through a real build, phase by phase.

Article author: Arthur Isaev