# Apache Maven

> A free build tool for Java. One pom.xml file describes the whole project.

**Field:** Software Development  
**Category:** Editors & Tools  
**Also known as:** Maven, mvn, pom.xml

## Think of it like

It is like a school day with a set plan. Each class comes in the same order.

## Definition

Apache Maven is a free build tool for Java projects. The whole project is described in one file called pom.xml. That file lists the packages the project needs, and Maven fetches them. Maven expects a fixed folder layout, with code in src/main/java. It runs a set list of phases, like compile, test and package. The finished jar file lands in the target folder.

## Example

Lucy clones a Java project and types mvn package. Maven fetches the packages, runs the tests and puts the jar in target.

## Example code

```console
$ mvn package
[INFO] Building jar: target/my-app-1.0-SNAPSHOT.jar
[INFO] BUILD SUCCESS
```

One command builds, tests and packs the code. The jar goes in the target folder.

## Why it matters

Every Maven project looks the same inside. A new person can build any of them with one command.

## Common mistake

Fighting the folder layout. Put files where Maven expects them, or it will not find your code.

## Three principles

- **One file.** pom.xml describes the whole project.
- **Fixed layout.** Code goes in src/main/java.
- **Set phases.** Compile, test, package, in that order.

## Related terms

- [Build Tool](https://learn.benibix.com/term/development/build-tool)
- [Java](https://learn.benibix.com/term/development/java)
- [Gradle](https://learn.benibix.com/term/development/gradle)
- [Dependency](https://learn.benibix.com/term/development/dependency)
- [Extensible Markup Language (XML)](https://learn.benibix.com/term/development/xml)
- [Build Artifact](https://learn.benibix.com/term/development/build-artifact)

## Told apart from

- [Maven vs Gradle](https://learn.benibix.com/compare/maven-vs-gradle): People think Gradle is just Maven with a new file, and it is not. Maven describes a project in pom.xml and runs a fixed list of steps. A Gradle build file is code, in Kotlin or Groovy, so you can add steps of your own. Gradle also skips work that has not changed. Both can fetch packages from Maven Central.

## Taught in

- [Make, Maven and Gradle](https://learn.benibix.com/learn/development-tools/make-maven-and-gradle): Coding Tools, 12/13

![Source files on the left go into a build tool in the middle, which reads a recipe file: a Makefile, a pom.xml or a build.gradle.kts. Inside the tool, three steps run in order: compile, test, package. On the right comes the result, a program or a jar file. Below, a task runner row shows npm run build running the real command behind it, vite build.](https://learn.benibix.com/diagrams/dev5-build-tool.svg)

---

Source: https://learn.benibix.com/term/development/apache-maven
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
