Maven-11: 从命令行调用插件
mvn -h显示mvn命令帮助:
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
-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
-h,--help Display help information
-l,--log-file <arg> Log file to where all build output
will go.
-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,--threads <arg> Thread count, for instance 2.0C
where C is core multiplied
-t,--toolchains <arg> Alternate path for the user
toolchains file
-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,--show-version Display version information
WITHOUT stopping build
-v,--version Display version information
-X,--debug Produce execution debug output
goal和phase分别指插件目标和生命周期阶段。
我们知道,可以通过mvn命令激活生命周期阶段,从而执行那些绑定在生命周期阶段上的插件目标。但Maven还支持直接从命令行调用插件目标。Maven支持这种方式是因为有些任务不适合绑定在生命周期上,例如maven-help-plugin:describe,我们不需要在构建项目的时候去描述插件信息。又如maven-dependency-plugin:tree,我们也不需要在构建项目的时候去显示依赖树。因此这些插件目标应该通过如下方式使用:
$ mvn help:describe -Dplugin=compiler
$ mvn dependency:tree
不过,这里还有一个疑问,describe是maven-help-plugin的目标没错,但冒号前面的help是什么呢?它既不是groupId,也不是artifactId,Maven是如何根据该信息找到对应版本插件的呢?同理,为什么不是maven-dependency-plugin:tree而是dependency:tree呢?
解答该疑问之前,可以先尝试一下如下的命令:
$ mvn org.apache.maven.plugins:maven-help-plugin:2.1:describe -Dplugin=compiler
$ mvn org.apache.maven.plugins:maven-dependency-plugin:2.1:tree
这两条命令就比较容易理解了。它们的效果与之前的两条命令基本是一样的,但显然前面的命令更简洁,更容易记忆和使用。为了达到该目的,Maven引入了目标前缀的概念。help是maven-help-plugin的目标前缀,dependency是maven-dependency-plugin的目标前缀,有了插件前缀,Maven就能找到对应的artifactId。不过仅有artifactId,而没有groupId和version,Maven是无法精确定位到某个插件的。那么,Maven是如何做到的呢?我们将在后面的文章详细剖析这个问题。
Maven-11: 从命令行调用插件的更多相关文章
- Java项目导出为jar包+导出第三方jar包+使用命令行调用+传参
Java项目导出为jar包+导出第三方jar包+使用命令行调用+传参 一.打包 情况1:不需要向程序传参数,并且程序没有使用第三方jar包 Eclipse上导出jar: 然后选择一个java文件作为入 ...
- Symfony2 通过命令行调用控制器
由于系统需求,需要写一个无限循环的控制器,那么既然有一个无限循环的控制器,那么就需要有一个开关,不可能直接通过route来开启吧.当然要使用高级一点的方法啊. 那就是使用控制台通过命令行(comman ...
- 命令行调用dubbo远程服务
命令行调用dubbo远程服务 telnet远程连接到dubbo telnet 127.0.0.1 20880 查看提供服务的接口 dubbo>ls com.test.service.TestIn ...
- VB6 实现命令行调用时附着到原控制台
Public Declare Function AttachConsole Lib "kernel32.dll" (ByVal ProcessID As Integer) As B ...
- blockdev - 从命令行调用区块设备控制程序
总览(SYNOPSIS) blockdev [options] commands devices 描述(DESCRIPTION) blockdev 工具允许从命令行调用区块设备控制程序. 选项(OPT ...
- Shodan搜索引擎详解及Python命令行调用
shodan常用信息搜索命令 shodan配置命令 shodan init T1N3uP0Lyeq5w0wxxxxxxxxxxxxxxx //API设置 shodan信息收集 shodan myip ...
- Linux中级之ansible概念及hoc命令行调用模式
一.Ansible简介 ansible是新出现的开源的自动化运维工具,基于Python开发,集合了众多运维工具(puppet.cfengine.chef.func.fabric)的优点,实现了批量系统 ...
- 软工+C(11): 从命令行开始逐步培养编程能力(Java)
上一篇:助教指南,持续更新... // Version: 0.0.4 许多人,所不知道的是,每一种编程语言都有其对应的单元测试框架,对程序在不同阶段的测试环节也概念模糊.在实际动手编写程序许久之后才听 ...
- 使用Ant 和 Maven打包发布命令行程序(转载)
From:https://www.linux178.com/Java/maven-release.html 用Java写了一个命令行的小程序,使用的Intellij IDE是IDEA13原来一直使用A ...
随机推荐
- Centos小白学习
目录 查看机器设备信息 有线网络设置(必须) 设置主机名(必须) 设置sudo用户,一般默认只有root可以使用(必须) yum更新源(必须) 安装完Centos后桌面宽度不能自适应 Centos安装 ...
- SQL中partition关键字的使用
最近在写后台语句时候,运用到了partition这样一个关键字. 先大致说一下背景,有一种数据表,如下 现在需要取出,每一个人最近的一次打卡时间. 思路是,先把数据按照人名分组,然后在每个组里面按照时 ...
- VS2005 添加lib 的方法
应用程序使用外部库时需要进行加载,两种库的加载本质上都是一样:提供功能和功能的定义.vs2005 c++ 项目设置外部库方法如下:1. 添加编译所需要(依赖)的 lib 文件 在"项 ...
- Java中过滤出字母、数字和中文的正则表达式
1.Java中过滤出字母.数字和中文的正则表达式 (1)过滤出字母的正则表达式 [^(A-Za-z)] (2)过滤出数字的正则表达式 [^(0-9)] (3)过滤出中文的正则表达式 [^(\\u4e0 ...
- dijit.byId("grid") is undefined
1.错误描述 TypeError:dijit.byId(...) is undefined (68 out of range 3) 2.错误原因 var gridName = dijit ...
- HTML5结合CSS的三种方法+结合JS的三种方法
HTML5+CSS: HTML中应用CSS的三种方法 一.内联 内联样式通过style属性直接套进HTML中去. 示例代码 <pstylepstyle="color:red" ...
- Linux下检测内存泄露的工具 valgrind
参考:http://www.cnblogs.com/sunyubo/archive/2010/05/05/2282170.html 几乎是照抄参考过来的,只不过后面自己调试一下代码. 这里主要介绍Va ...
- Complete the Word CodeForces - 716B
ZS the Coder loves to read the dictionary. He thinks that a word is nice if there exists asubstring ...
- 基于Global.asax实现显示当前在线人数--ASP.NET基础
相对来说比较简单,直接贴代码了哈: Global.asax: <%@ Application Language="C#" %><script runat=&quo ...
- C#隐式转换和显示转换举例--C#基础
高精度的数据类型转换为低精度的数据类型是显示转换,低精度的转换为高精度的是隐式转换. 温馨提示:不能说强制类型转换是从低精度到高精度. int a=666;float b=(float)a: 由a到b ...