The pom.xml line by line
A pom is an XML file called pom.xml at the root of the project. It is the project object model, which is a long name for a short idea: the file says who the project is, what it needs, and how it should be built. Everything else the lifecycle does is a default that the file can change. This article reads the pom of the calculator project the course builds.
The file
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</groupId>
<artifactId>calc</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<name>Calculator</name>
<description>A calculator used by the Maven course</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.release>21</maven.compiler.release>
<junit.version>5.14.3</junit.version>
</properties>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Thirty lines and five ideas: the model version, the four coordinates, the name and the description, the properties and the dependencies. There is no build section, because this project needs none: the compiler reads the property and the jar goes to the default place.
modelVersion
<modelVersion>4.0.0</modelVersion> says which version of the pom schema the file follows. It is 4.0.0 for every Maven 2 and Maven 3 project and has nothing to do with the version of the project or of Maven. It is the one element Maven insists on: a pom without it, or with 3.0.0, is a Maven 1 model and is rejected with a message that says so.
The project element at the top carries the XML namespace and the schema location. Every editor uses them to validate the file as you type, and Maven itself does not need them, but a pom without them is not valid XML in the view of the next tool that reads it.
Coordinates, name and properties
groupId, artifactId, version and packaging are the coordinates: who the project belongs to, what it is called, which version it is and what it produces. The next article follows them into the build log and into the local repository, because they are the same four values in all three places.
name and description are for people and for the site Maven can generate. The name has one visible effect in the log: the line that would say Building calc 1.0.0 says Building Calculator 1.0.0 instead.
properties is a map of names to values, and a value is read wherever ${name} appears. Three properties in this pom are read by plugins that never see them as properties: project.build.sourceEncoding is the encoding of the resources plugin and of the compiler, maven.compiler.release is the release of the compiler, and junit.version holds a version used twice. The properties article takes them apart.
What Maven read
help:evaluate prints the value of one expression of the model, and with -q and -DforceStdout it prints that value alone, without the log around it. Three expressions show what Maven has in hand:
mvn -B -q help:evaluate -Dexpression=project.artifactId -DforceStdout
mvn -B -q help:evaluate -Dexpression=project.packaging -DforceStdout
mvn -B -q help:evaluate -Dexpression=project.name -DforceStdout
calc
jar
Calculator
packaging is jar although the pom says so explicitly, and it would be jar without that line too: jar is the default packaging of a project. The line is there because a pom that states it reads better; the lifecycle article shows what the other packagings change.
A tag Maven does not know
The pom schema is strict about element names, and a misspelling is a reading error, not a warning. Here is the same pom with name written as namee, and everything else as before:
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</groupId>
<artifactId>calc</artifactId>
<namee>Calculator</namee>
<version>1.0.0</version>
</project>
The shortest command that reads the pom is validate, the first phase of the default lifecycle:
mvn -B validate > broken.log 2>&1; echo "status: $?"; sed "s#$PWD#<project>#g" broken.log
status: 1
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Malformed POM <project>/pom.xml: Unrecognised tag: 'namee' (position: START_TAG seen ...</artifactId>\n <namee>... @9:10) @ <project>/pom.xml, line 9, column 10
@
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project com.example:calc:1.0.0 (<project>/pom.xml) has 1 error
[ERROR] Malformed POM <project>/pom.xml: Unrecognised tag: 'namee' (position: START_TAG seen ...</artifactId>\n <namee>... @9:10) @ <project>/pom.xml, line 9, column 10 -> [Help 2]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/ModelParseException
The message gives the line and the column, the tag it did not expect and the text around it, which is everything needed to fix it. Nothing was built: the pom is read before any phase runs, and a pom that cannot be read stops the build with a ProjectBuildingException, the same family of error as the missing plugin of the errors article.
With the tag spelled correctly the same command reads the pom and stops at the first phase:
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</groupId>
<artifactId>calc</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<name>Calculator</name>
<description>A calculator used by the Maven course</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.release>21</maven.compiler.release>
<junit.version>5.14.3</junit.version>
</properties>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
mvn -B validate > fixed.log 2>&1; echo "status: $?"; sed "s#$PWD#<project>#g" fixed.log
status: 0
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------------< com.example:calc >--------------------------
[INFO] Building Calculator 1.0.0
[INFO] from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.202 s
[INFO] Finished at: 2026-11-22T08:32:09Z
[INFO] ------------------------------------------------------------------------
The log names the coordinates Maven read, the name, the version and the packaging, and then nothing runs: validate has no work of its own. The effective pom article shows the model Maven ends up with, which is this file plus every default and every inherited value.
Where to go next
Coordinates follows the four values of this pom into the build log, the jar name and the local repository. The properties article takes the three properties apart, and the effective pom shows what Maven adds to this file by itself.
Article author: Arthur Isaev