Maven命令的常用参数以及说明
参数及说明查看命令
mvn -h
或者
mvn -help
使用以上命令可查看,maven常用参数以及说明,结果如下图:
C:\projectPackage>mvn -h
usage: mvn [options] [<goal(s)>] [<phase(s)>]
Options:
-am,--also-make If project list is specified, also
build projects required by the
list
-amd,--also-make-dependents If project list is specified, also
build projects that depend on
projects on the list
-B,--batch-mode Run in non-interactive (batch)
mode (disables output color)
-b,--builder <arg> The id of the build strategy to
use
-C,--strict-checksums Fail the build if checksums don't
match
-c,--lax-checksums Warn if checksums don't match
-cpu,--check-plugin-updates Ineffective, only kept for
backward compatibility
-D,--define <arg> Define a system property
-e,--errors Produce execution error messages
-emp,--encrypt-master-password <arg> Encrypt master security password
-ep,--encrypt-password <arg> Encrypt server password
-f,--file <arg> Force the use of an alternate POM
file (or directory with pom.xml)
-fae,--fail-at-end Only fail the build afterwards;
allow all non-impacted builds to
continue
-ff,--fail-fast Stop at first failure in
reactorized builds
-fn,--fail-never NEVER fail the build, regardless
of project result
-gs,--global-settings <arg> Alternate path for the global
settings file
-gt,--global-toolchains <arg> Alternate path for the global
toolchains file
-h,--help Display help information
-l,--log-file <arg> Log file where all build output
will go (disables output color)
-llr,--legacy-local-repository Use Maven 2 Legacy Local
Repository behaviour, ie no use of
_remote.repositories. Can also be
activated by using
-Dmaven.legacyLocalRepo=true
-N,--non-recursive Do not recurse into sub-projects
-npr,--no-plugin-registry Ineffective, only kept for
backward compatibility
-npu,--no-plugin-updates Ineffective, only kept for
backward compatibility
-nsu,--no-snapshot-updates Suppress SNAPSHOT updates
-o,--offline Work offline
-P,--activate-profiles <arg> Comma-delimited list of profiles
to activate
-pl,--projects <arg> Comma-delimited list of specified
reactor projects to build instead
of all projects. A project can be
specified by [groupId]:artifactId
or by its relative path
-q,--quiet Quiet output - only show errors
-rf,--resume-from <arg> Resume reactor from specified
project
-s,--settings <arg> Alternate path for the user
settings file
-t,--toolchains <arg> Alternate path for the user
toolchains file
-T,--threads <arg> Thread count, for instance 2.0C
where C is core multiplied
-U,--update-snapshots Forces a check for missing
releases and updated snapshots on
remote repositories
-up,--update-plugins Ineffective, only kept for
backward compatibility
-v,--version Display version information
-V,--show-version Display version information
WITHOUT stopping build
-X,--debug Produce execution debug output
第一个 参数为缩减命令,后面为全称命令(也起到了缩写的解释作用),皆可使用。最后一列为该命令的作用的英文解释。
参数说明中文对照
以上是英文版,英语不错的可以推荐看一下,原汁原味,需要自己理解,毕竟英文的技术文档不是单词都认识就行的,哈哈,下面附上中文解释(该处引自Maven常用参数及其说明):
-h,--help Display help information
-am,--also-make 构建指定模块,同时构建指定模块依赖的其他模块;
-amd,--also-make-dependents 构建指定模块,同时构建依赖于指定模块的其他模块;
-B,--batch-mode 以批处理(batch)模式运行;
-C,--strict-checksums 检查不通过,则构建失败;(严格检查)
-c,--lax-checksums 检查不通过,则警告;(宽松检查)
-D,--define <arg> Define a system property
-e,--errors 显示详细错误信息
-emp,--encrypt-master-password <arg> Encrypt master security password
-ep,--encrypt-password <arg> Encrypt server password
-f,--file <arg> 使用指定的POM文件替换当前POM文件
-fae,--fail-at-end 最后失败模式:Maven会在构建最后失败(停止)。如果Maven refactor中一个失败了,Maven会继续构建其它项目,并在构建最后报告失败。
-ff,--fail-fast 最快失败模式: 多模块构建时,遇到第一个失败的构建时停止。
-fn,--fail-never 从不失败模式:Maven从来不会为一个失败停止,也不会报告失败。
-gs,--global-settings <arg> 替换全局级别settings.xml文件(Alternate path for the global settings file)
-l,--log-file <arg> 指定输出日志文件
-N,--non-recursive 仅构建当前模块,而不构建子模块(即关闭Reactor功能)。
-nsu,--no-snapshot-updates 强制不更新SNAPSHOT(Suppress SNAPSHOT updates)
-U,--update-snapshots 强制更新releases、snapshots类型的插件或依赖库(否则maven一天只会更新一次snapshot依赖)
-o,--offline 运行offline模式,不联网进行依赖更新
-P,--activate-profiles <arg> 激活指定的profile文件列表(用逗号[,]隔开)
-pl,--projects <arg> 手动选择需要构建的项目,项目间以逗号分隔;A project can be specified by [groupId]:artifactId or by its relative path.
-q,--quiet 安静模式,只输出ERROR
-rf,--resume-from <arg> 从指定的项目(或模块)开始继续构建
-s,--settings <arg> 替换用户级别settings.xml文件(Alternate path for the user settings file)
-T,--threads <arg> Thread count, for instance 2.0C where C is core multiplied
-t,--toolchains <arg> Alternate path for the user toolchains file
-V,--show-version Display version information WITHOUT stopping build
-v,--version Display version information
-X,--debug 输出详细信息,debug模式。
-cpu,--check-plugin-updates 【废弃】,仅为了向后兼容
-npr,--no-plugin-registry 【废弃】,仅为了向后兼容
-npu,--no-plugin-updates 【废弃】,仅为了向后兼容
-up,--update-plugins 【废弃】,仅为了向后兼容
附:记录一下自己的项目生产的打包命令:mvn clean package -pl aipc-small-api -am -Pprd
解释一下就是先清除,再打包,选择指定需要构建的项目,并指定项目的groupId,除此之外,还需要构建所依赖的其他模块,最后选择prd环境进行构建
参考:
Maven常用参数及其说明