mvn [options] [<goal(s)>] [<phase(s)>]


Core pluginsPlugins corresponding to default core phases (ie. clean, compile). They may have multiple goals as well.
cleanClean up after the build.
compilerCompiles Java sources.
deployDeploy the built artifact to the remote repository.
failsafeRun the JUnit integration tests in an isolated classloader.
installInstall the built artifact into the local repository.
resourcesCopy the resources to the output directory for including in the JAR.
siteGenerate a site for the current project.
surefireRun the JUnit unit tests in an isolated classloader.
verifierUseful for integration tests – verifies the existence of certain conditions.
Packaging types/toolsThese plugins relate to packaging respective artifact types.
earGenerate an EAR from the current project.
ejbBuild an EJB (and optional client) from the current project.
jarBuild a JAR from the current project.
rarBuild a RAR from the current project.
warBuild a WAR from the current project.
app-client/acrBuild a JavaEE application client from the current project.
shadeBuild an Uber-JAR from the current project, including dependencies.
sourceBuild a source-JAR from the current project.
jlinkBuild Java Run Time Image.
jmodBuild Java JMod files.
Reporting pluginsPlugins which generate reports, are configured as reports in the POM and run under the site generation lifecycle.
changelogGenerate a list of recent changes from your SCM.
changesGenerate a report from an issue tracker or a change document.
checkstyleGenerate a Checkstyle report.
doapGenerate a Description of a Project (DOAP) file from a POM.
docckDocumentation checker plugin.
javadocGenerate Javadoc for the project.
jdepsRun JDK’s JDeps tool on the project.
jxrGenerate a source cross reference.
linkcheckGenerate a Linkcheck report of your project’s documentation.
pmdGenerate a PMD report.
project-info-reportsGenerate standard project reports.
surefire-reportGenerate a report based on the results of unit tests.
ToolsThese are miscellaneous tools available through Maven by default.
antrunRun a set of ant tasks from a phase of the build.
artifactManage artifacts tasks like buildinfo.
archetypeGenerate a skeleton project structure from an archetype.
assemblyBuild an assembly (distribution) of sources and/or binaries.
dependencyDependency manipulation (copy, unpack) and analysis.
enforcerEnvironmental constraint checking (Maven Version, JDK etc), User Custom Rule Execution.
gpgCreate signatures for the artifacts and poms.
helpGet information about the working environment for the project.
invokerRun a set of Maven projects and verify the output.
jarsignerSigns or verifies project artifacts.
jdeprscanRun JDK’s JDeprScan tool on the project.
patchUse the gnu patch tool to apply patch files to source code.
pdfGenerate a PDF version of your project’s documentation.
pluginCreate a Maven plugin descriptor for any mojos found in the source tree, to include in the JAR.
releaseRelease the current project – updating the POM and tagging in the SCM.
remote-resourcesCopy remote resources to the output directory for inclusion in the artifact.
scmExecute SCM commands for the current project.
scm-publishPublish your Maven website to a scm location.
scriptingThe Maven Scripting Plugin wraps the Scripting API according to JSR223.
stageAssists with release staging and promotion.
toolchainsAllows to share configuration across plugins.
wrapperDownload and unpack the maven wrapper distribution (works only with Maven 4)


PluginType*VersionRetired DateDescription
antB2.42019-06-02Generate an Ant build file for the project.
eclipseB2.102015-10-07Generate an Eclipse project files for the current project.
ideaB2.2.12013-07-26Create/update an IDEA workspace for the current project (individual modules are created as IDEA modules)
oneB1.32013-07-30A plugin for interacting with legacy Maven 1.x repositories and builds.
reactorB1.12014-03-24Build a subset of interdependent projects in a reactor (Maven 2 only).
repositoryB2.42019-04-30Plugin to help with repository-based tasks.

At MojoHaus

animal-snifferBuild signatures of APIs (JDK for example) and checks your classes against them.
build-helperAttach extra artifacts and source folders to build.
castorGenerate sources from an XSD using Castor.
clirrCompare binaries or sources for compatibility using Clirr
javaccGenerate sources from a JavaCC grammar.
jdependGenerate a report on code metrics using JDepend.
nar-maven-pluginCompiles C, C++, Fortran for different architectures.
nativeCompiles C and C++ code with native compilers.
sqlExecutes SQL scripts from files or inline.
taglistGenerate a list of tasks based on tags in your code.
versionsManage versions of your project, its modules, dependencies and plugins.


cargoStart/stop/configure J2EE containers and deploy to them.
cloverGenerate a Clover report.
jettyJetty Run a Jetty container for rapid webapp development.
jalopyUse Jalopy to format your source code.
ratRelease Audit Tool (RAT) to verify files.
Genesis PluginsVerify legal files in artifacts.
Apache TomcatRun an Apache Tomcat container for rapid webapp development.
OWASP dependency-checkRun OWASP Dependency-Check, a utility that identifies project dependencies and checks if there are any known, publicly disclosed, vulnerabilities.
CycloneDXGenerate Software Bill of Materials (SBOM) in CycloneDX format.
pgpverifyVerify PGP signature of all project dependencies.
buildplanInspect the lifecycle of your build.


Clean Lifecycle

pre-cleanexecute processes needed prior to the actual project cleaning
cleanremove all files generated by the previous build
post-cleanexecute processes needed to finalize the project cleaning

Default Lifecycle

validatevalidate the project is correct and all necessary information is available.
initializeinitialize build state, e.g. set properties or create directories.
generate-sourcesgenerate any source code for inclusion in compilation.
process-sourcesprocess the source code, for example to filter any values.
generate-resourcesgenerate resources for inclusion in the package.
process-resourcescopy and process the resources into the destination directory, ready for packaging.
compilecompile the source code of the project.
process-classespost-process the generated files from compilation, for example to do bytecode enhancement on Java classes.
generate-test-sourcesgenerate any test source code for inclusion in compilation.
process-test-sourcesprocess the test source code, for example to filter any values.
generate-test-resourcescreate resources for testing.
process-test-resourcescopy and process the resources into the test destination directory.
test-compilecompile the test source code into the test destination directory
process-test-classespost-process the generated files from test compilation, for example to do bytecode enhancement on Java classes.
testrun tests using a suitable unit testing framework. These tests should not require the code be packaged or deployed.
prepare-packageperform any operations necessary to prepare a package before the actual packaging. This often results in an unpacked, processed version of the package.
packagetake the compiled code and package it in its distributable format, such as a JAR.
pre-integration-testperform actions required before integration tests are executed. This may involve things such as setting up the required environment.
integration-testprocess and deploy the package if necessary into an environment where integration tests can be run.
post-integration-testperform actions required after integration tests have been executed. This may including cleaning up the environment.
verifyrun any checks to verify the package is valid and meets quality criteria.
installinstall the package into the local repository, for use as a dependency in other projects locally.
deploydone in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects.

Site Lifecycle

pre-siteexecute processes needed prior to the actual project site generation
sitegenerate the project’s site documentation
post-siteexecute processes needed to finalize the site generation, and to prepare for site deployment
site-deploydeploy the generated site documentation to the specified web server


Maven 生命周期是抽象的,其本身不能做任何实际工作,这些实际工作(如源代码编译)都通过调用 Maven 插件 中的插件目标(plugin goal)完成的。

Clean Lifecycle Bindings


Default Lifecycle Bindings – Packaging ejb / ejb3 / jar / par / rar / war

packageejb:ejb or ejb3:ejb3 or jar:jar or par:par or rar:rar or war:war

Default Lifecycle Bindings – Packaging ear


Default Lifecycle Bindings – Packaging maven-plugin

packagejar:jar and plugin:addPluginArtifactMetadata

Default Lifecycle Bindings – Packaging pom


Site Lifecycle Bindings



上一篇 2021年6月4日 16:21
下一篇 2021年7月10日 03:04