← 返回命令列表

Linux command

mvn-package 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Build package

mvn package

Build skipping tests

mvn package -DskipTests

Build with profile

mvn package -P [production]

Build clean package

mvn clean package

说明

mvn package builds the project and creates a distributable package (JAR, WAR, etc.). Executes compile, test, and package phases. Output goes to target/ directory.

参数

-DskipTests
Skip test execution.
-Dmaven.test.skip
Skip test compilation and execution.
-P _profile_
Activate profile.
-o
Work offline.
-T _threads_
Parallel builds.

FAQ

What is the mvn-package command used for?

mvn package builds the project and creates a distributable package (JAR, WAR, etc.). Executes compile, test, and package phases. Output goes to target/ directory.

How do I run a basic mvn-package example?

Run `mvn package` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -DskipTests do in mvn-package?

Skip test execution.