Maven coordinates and POM
What you will learn
Maven describes a project in pom.xml: its identity, dependencies and build configuration. The build tool reads this model and invokes plugins. It does not replace the Java compiler.
- Identify groupId, artifactId, version and packaging.
- Organize Java source, resources and build output using standard directories.
- Distinguish parent inheritance from aggregation.
Prerequisite: Java packages, classpath and basic terminal compilation. Maven CLI examples are static and not executed in this batch. The project is local and fictional; use only reviewed source and approved cached dependencies.
Minimal POM
<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>example.bytemind</groupId> <artifactId>hello</artifactId> <version>1.0.0</version> <properties> maven.compiler.release>21 /maven.compiler.release> project.build.sourceEncoding>UTF-8 /project.build.sourceEncoding> </properties> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.14.0</version> <configuration> <proc>none</proc> </configuration> </plugin> </plugins> </build></project>Complete hello project POM (source-reviewed, Maven not run). The corresponding Main.java is in the bundled v24-hello fixture. With approved Maven/cache, mvn -o package should create target/hello-1.0.0.jar. This is a regular JAR; no Main-Class is configured.
Coordinates and layout
A coordinate identifies an artifact: groupId is the naming namespace, artifactId is the artifact name, and version selects a release. Packaging defaults to jar; pom is used for model-only projects. Dependency coordinates can additionally specify type and classifier. Neither a Java package nor an artifactId alone identifies a unique dependency. Maven convention places production Java in src/main/java, resources in src/main/resources, test Java in src/test/java and output in target. Source resources are usually copied into the runtime classpath. A JAR is an archive, not automatically a runnable or self-contained application.
Inheritance versus aggregation
A child parent element inherits model configuration; an aggregator modules list collects projects into a reactor. They are separate relationships even when the same POM performs both roles. Every module has its own identity and packaging. A parent can manage plugin versions without adding arbitrary executions; plugins actually bound to lifecycle phases or explicitly invoked perform work. In the example the compiler release targets Java 21 APIs and class files, not necessarily the JDK that launches Maven.
Trust and versions
Use a reviewed Maven 3 installation and JDK 21, plus a preapproved local repository containing the pinned plugin artifacts and transitives. The selected historical plugin versions illustrate fixed versions, not a current security recommendation. Verify compatibility and advisories before use. Maven wrappers, plugins and extensions execute code; offline mode reduces downloads but is not a security sandbox. Never run unknown POMs or use credentials in examples.
A complete Java entry point
public class Main { public static void main(String[] args) { System.out.println("Ready"); }}Tested independently with javac --release 21 -proc:none Main.java then java Main: prints Ready. This verifies Java only, not the Maven lifecycle.
A parent and reactor
<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>example.bytemind</groupId> <artifactId>warehouse-parent</artifactId> <version>1.0.0</version> <packaging>pom</packaging> <modules> <module>core</module> <module>app</module> </modules> <properties> maven.compiler.release>21 /maven.compiler.release> project.build.sourceEncoding>UTF-8 /project.build.sourceEncoding> project.build.outputTimestamp>2026-01-01T00:00:00Z /project.build.outputTimestamp> </properties> <dependencyManagement> <dependencies> <dependency> <groupId>example.bytemind</groupId> <artifactId>warehouse-core</artifactId> <version>${project.version}</version> </dependency> </dependencies> </dependencyManagement> <build> <pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.14.0</version> <configuration> <proc>none</proc> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <version>3.3.1</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>3.4.2</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>3.5.4</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-clean-plugin</artifactId> <version>3.4.1</version> </plugin> </plugins> </pluginManagement> </build></project>Complete parent POM for the included core/app project. The modules inherit common plugin settings and managed core version. The parent produces no Java JAR. The reactor orders actual project dependencies before consumers; merely listing modules or managing a version is not a dependency.
Common mistakes
Do not place Java files directly beside pom.xml and expect the conventional compiler source root to include them. Do not equate packaging jar with a fat JAR or executable manifest. A parent relationship alone does not add a library to the runtime classpath.
Practice
Inspect the warehouse parent and both child POMs. Write the three effective GAV coordinates, packaging values, and source/resource directories. Identify which two files carry the inheritance and aggregation relationships.
Use the manual practice hints; explain your reasoning before consulting the private review solution.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Maven coordinates and POM — knowledge check
Maven 3 model and build engineering knowledge check; source-reviewed, not Maven-executed.
Which fields form a basic Maven GAV?
What is default packaging when omitted?
Where do conventional production Java files go?
Does a modules list automatically make core an app dependency?
What does maven.compiler.release control?