Simple Project Object Model
When Maven executes, it looks to the Project Object Model
for information about the project. The
POM answers such questions as: What type of project
is this? What is the projectâs name? Are there any build
customizations for this project? Example 3-1 shows the default pom.xml file created by the Maven Archetype
pluginâs create
goal.
Example 3-1. Simple projectâs pom.xml file
<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/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.sonatype.mavenbook.ch03</groupId> <artifactId>simple</artifactId> <packaging>jar</packaging> <version>1.0-SNAPSHOT</version> <name>simple</name> <url>http://maven.apache.org</url> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> </dependencies> </project>
This pom.xml file is the
most basic POM you will ever deal with for a Maven
project. Usually a POM file is considerably more
complex, defining multiple dependencies and customizing plugin
behavior. The first few elementsâgroupId
,
artifactId
, packaging
,
version
âare known as the Maven coordinates, which uniquely identify
a project. name
and url
are
descriptive elements of the POM, providing a
human-readable name and associating the project with a project web
site. Lastly, the dependencies ...
Get Maven: The Definitive Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.