target directory
The folder where Maven writes everything a build produces: compiled classes, test reports and the packaged JAR.
In more detail
Each lifecycle step leaves a subfolder, such as classes, test-classes and surefire-reports. It is generated output, so it is excluded from version control and safe to delete. The packaged artifact is named from the coordinates, such as target/inventory-1.0.0.jar.
Example
ls target # classes generated-sources surefire-reports test-classesRelated terms
- Maven build lifecycle — Maven's fixed, ordered list of phases, validate, compile, test, package, verify, install and deploy, where asking for one runs all before it.
- JAR file — A zip archive holding compiled classes and resources, plus a manifest describing them, which the JVM can load directly.
Taught in
- The Toolchain: Maven — Modern Java: Virtual Threads & High-Throughput Services
- Packaging Into A Container — Modern Java: Virtual Threads & High-Throughput Services