mvn Verified current stable Not installed? Build Tools

Mvn / Package Project Common

Package Project Common

Use 'mvn package' to compile and package your Maven project into a distributable format like JAR.

$
Terminal
mvn package

When To Use

Use this command to create a distributable package of your Maven project.

Terminal Output

Expected runtime feedback

Simulated preview
>
Output
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ my-project ---
[INFO] Compiling 1 source file to /path/to/my-project/target/classes
[INFO] --- maven-jar-plugin:3.2.0:jar (default-jar) @ my-project ---
[INFO] Building jar: /path/to/my-project/target/my-project-1.0-SNAPSHOT.jar

Command Breakdown

What each part is doing

mvn
Base Command
The executable that performs this operation. Here it runs Mvn before the shell applies any redirect operators.

How To Run

Execution path

  1. Step 1

    Open a terminal and navigate to your Maven project directory.

  2. Step 2

    Run the command 'mvn package' to compile and package the project.

Alternative Approaches

Comparable commands in other tools

Alternative build tools tools for the same job.