文章
问答
冒泡
maven之mvn命令行使用简单说明

命令参数说明

#用法: 
mvn [options] [<goal(s)>] [<phase(s)>]

#Options说明:
 -am,--also-make                        #构建指定的项目列表时,会级联构建其引用的其他模块
 -amd,--also-make-dependents            #构建指定的项目列表时,会级联构建引用了它(被指定的项目列表)的项目
 -B,--batch-mode                        #禁用带颜色输出,非交互模式下可使用
 -b,--builder <arg>                     The id of the build strategy to
                                        use
 -C,--strict-checksums                  #校验和(checksums)不匹配时,则校验失败
 -c,--lax-checksums                     #校验和(checksums)不匹配时,则警告
 -cpu,--check-plugin-updates            #无效,只是向后兼容
 -D,--define <arg>                      #定义系统属性
 -e,--errors                            #生成执行错误信息
 -emp,--encrypt-master-password <arg>   Encrypt master security password
 -ep,--encrypt-password <arg>           Encrypt server password
 -f,--file <arg>                        #强制使用备用POM文件(或带有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                       #无论项目构建结果如何,都要继续执行构建操作(同时构建多个项目时,如果前面的项目构建失败了,则会继续构建后面的项目)
 -gs,--global-settings <arg>            Alternate path for the global
                                        settings file
 -gt,--global-toolchains <arg>          Alternate path for the global
                                        toolchains file
 -h,--help                              #显示帮助信息
 -l,--log-file <arg>                    #输出构建日志到指定的文件中(不会带颜色提醒)
 -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                     #限制只在当前目录中进行构建
 -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
 -ntp,--no-transfer-progress            Do not display transfer progress
                                        when downloading or uploading
 -o,--offline                           #脱机工作
 -P,--activate-profiles <arg>           #激活以逗号分隔的配置标志(profiles),pom文件中要有对应配置
 -pl,--projects <arg>                   #构建指定的以逗号分隔的项目,一个项目可以通过[groupId]:artifactId或它的相对路径指定
 -q,--quiet                             #以只显示错误的方式执行构建过程(不会打印正常的日志)
 -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                           #显示版本信息
 -V,--show-version                      #显示版本信息,并进行构建操作
 -X,--debug                             #输出详细构建日志(debug模块)

 

使用举例

#构建指定项目,并级联构建其引用的其他项目
mvn clean package -am -pl 项目名称1,项目名称2
​
#构建指定项目,并级联构建引用了它(被指定的项目)的项目
mvn clean package -amd -pl 项目名称1

关于作者

justin
123456
获得点赞
文章被阅读