1.说明

工作中使用到很多的Maven插件,
从网上拷贝别人的配置用起来很简单,
但是想改几个参数就感觉无处下手了,
当然可以从插件的官方网站查看帮助手册,
也可以通过Maven的help命令查看插件帮助,
包括插件的简略和详细的描述信息,
也可以查看插件所有的目标goal,
以及插件的配置参数等。

2.帮助命令

在命令行下面,
使用Maven的help:describe目标查看插件信息:

mvn help:describe -Dplugin=插件标识

通过plugin参数指定要查看的插件,插件标识可以是groupId:artifactId[:version]形式的,
其中version是可选的,
也可以是插件前缀,
它是插件的简称,
插件前缀和插件是一一对应的,
这种对应关系存储在Maven仓库元数据中:https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml
比如插件前缀help和插件maven-help-plugin是对应的:

<plugin>
<name>Apache Maven Help Plugin</name>
<prefix>help</prefix>
<artifactId>maven-help-plugin</artifactId>
</plugin>

3.使用举例

下面查看maven-help-plugin插件的信息,
即查看帮助命令自己的信息,
下面两条命令是等价的:

mvn help:describe -Dplugin=org.apache.maven.plugins:maven-help-plugin
mvn help:describe -Dplugin=help

输出查询结果如下:

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-help-plugin:3.2.0:describe (default-cli) @ standalone-pom ---
[INFO] org.apache.maven.plugins:maven-help-plugin:3.2.0Name: Apache Maven Help Plugin
Description: The Maven Help plugin provides goals aimed at helping to makesense out of the build environment. It includes the ability to view theeffective POM and settings files, after inheritance and active profiles havebeen applied, as well as a describe a particular plugin goal to give usageinformation.
Group Id: org.apache.maven.plugins
Artifact Id: maven-help-plugin
Version: 3.2.0
Goal Prefix: helpThis plugin has 8 goals:help:active-profilesDescription: Displays a list of the profiles which are currently active forthis build.help:all-profilesDescription: Displays a list of available profiles under the currentproject.Note: it will list all profiles for a project. If a profile comes up with astatus inactive then there might be a need to set profile activationswitches/property.help:describeDescription: Displays a list of the attributes for a Maven Plugin and/orgoals (aka Mojo - Maven plain Old Java Object).help:effective-pomDescription: Displays the effective POM as an XML for this build, with theactive profiles factored in, or a specified artifact. If verbose, a commentis added to each XML element describing the origin of the line.help:effective-settingsDescription: Displays the calculated settings as XML for this project,given any profile enhancement and the inheritance of the global settingsinto the user-level settings.help:evaluateDescription: Evaluates Maven expressions given by the user in aninteractive mode.help:helpDescription: Display help information on maven-help-plugin.Call mvn help:help -Ddetail=true -Dgoal=<goal-name> to display parameterdetails.help:systemDescription: Displays a list of the platform details like system propertiesand environment variables.For more information, run 'mvn help:describe [...] -Ddetail'[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.613 s
[INFO] Finished at: 2021-10-12T15:38:22+08:00
[INFO] ------------------------------------------------------------------------

可以看到maven-help-plugin对应的插件前缀是help:

Group Id: org.apache.maven.plugins
Artifact Id: maven-help-plugin
Version: 3.2.0
Goal Prefix: help

可以看到help:describe用来查看插件的属性和目标:

help:describeDescription: Displays a list of the attributes for a Maven Plugin and/orgoals (aka Mojo - Maven plain Old Java Object).

可以看到help命令自带的帮助:

mvn help:help

输出的结果基本和上面的相同,
这里更推荐使用help:describe命令。

4.查看详细信息

通过在命令后追加-Ddetail参数,
可以查看插件的详细信息:

简略信息:
mvn help:describe -Dplugin=help
详细信息:
mvn help:describe -Dplugin=help -Ddetail

详细信息输出如下,
这是可以看到每个goal的配置参数说明:

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-help-plugin:3.2.0:describe (default-cli) @ standalone-pom ---
[INFO] org.apache.maven.plugins:maven-help-plugin:3.2.0Name: Apache Maven Help Plugin
Description: The Maven Help plugin provides goals aimed at helping to makesense out of the build environment. It includes the ability to view theeffective POM and settings files, after inheritance and active profiles havebeen applied, as well as a describe a particular plugin goal to give usageinformation.
Group Id: org.apache.maven.plugins
Artifact Id: maven-help-plugin
Version: 3.2.0
Goal Prefix: helpThis plugin has 8 goals:help:active-profilesDescription: Displays a list of the profiles which are currently active forthis build.Implementation: org.apache.maven.plugins.help.ActiveProfilesMojoLanguage: javaAvailable parameters:outputUser property: outputOptional parameter to write the output of this help in a given file,instead of writing to the console.Note: Could be a relative path.help:all-profilesDescription: Displays a list of available profiles under the currentproject.Note: it will list all profiles for a project. If a profile comes up with astatus inactive then there might be a need to set profile activationswitches/property.Implementation: org.apache.maven.plugins.help.AllProfilesMojoLanguage: javaAvailable parameters:outputUser property: outputOptional parameter to write the output of this help in a given file,instead of writing to the console.Note: Could be a relative path.help:describeDescription: Displays a list of the attributes for a Maven Plugin and/orgoals (aka Mojo - Maven plain Old Java Object).Implementation: org.apache.maven.plugins.help.DescribeMojoLanguage: javaAvailable parameters:artifactIdUser property: artifactIdThe Maven Plugin artifactId to describe.Note: Should be used with groupId parameter.cmdUser property: cmdA Maven command like a single goal or a single phase following the Mavencommand line:mvn [options] [<goal(s)>] [<phase(s)>]detail (Default: false)User property: detailThis flag specifies that a detailed (verbose) list of goal (Mojo)information should be given.goalUser property: goalThe goal name of a Mojo to describe within the specified Maven Plugin. Ifthis parameter is specified, only the corresponding goal (Mojo) will bedescribed, rather than the whole Plugin.groupIdUser property: groupIdThe Maven Plugin groupId to describe.Note: Should be used with artifactId parameter.minimal (Default: false)User property: minimalThis flag specifies that a minimal list of goal (Mojo) information shouldbe given.outputUser property: outputOptional parameter to write the output of this help in a given file,instead of writing to the console.Note: Could be a relative path.pluginAlias: prefixUser property: pluginThe Maven Plugin to describe. This must be specified in one of threeways:1.  plugin-prefix, i.e. 'help'2.  groupId:artifactId, i.e. 'org.apache.maven.plugins:maven-help-plugin'3.  groupId:artifactId:version, i.e.'org.apache.maven.plugins:maven-help-plugin:2.0'versionUser property: versionThe Maven Plugin version to describe.Note: Should be used with groupId/artifactId parameters.help:effective-pomDescription: Displays the effective POM as an XML for this build, with theactive profiles factored in, or a specified artifact. If verbose, a commentis added to each XML element describing the origin of the line.Implementation: org.apache.maven.plugins.help.EffectivePomMojoLanguage: javaAvailable parameters:artifactUser property: artifactThe artifact for which to display the effective POM.Note: Should respect the Maven format, i.e. groupId:artifactId[:version].The latest version of the artifact will be used when no version isspecified.outputUser property: outputOptional parameter to write the output of this help in a given file,instead of writing to the console.Note: Could be a relative path.verbose (Default: false)User property: verboseOutput POM input location as comments.help:effective-settingsDescription: Displays the calculated settings as XML for this project,given any profile enhancement and the inheritance of the global settingsinto the user-level settings.Implementation: org.apache.maven.plugins.help.EffectiveSettingsMojoLanguage: javaAvailable parameters:outputUser property: outputOptional parameter to write the output of this help in a given file,instead of writing to the console.Note: Could be a relative path.showPasswords (Default: false)User property: showPasswordsFor security reasons, all passwords are hidden by default. Set this totrue to show all passwords.help:evaluateDescription: Evaluates Maven expressions given by the user in aninteractive mode.Implementation: org.apache.maven.plugins.help.EvaluateMojoLanguage: javaAvailable parameters:artifactUser property: artifactAn artifact for evaluating Maven expressions.Note: Should respect the Maven format, i.e. groupId:artifactId[:version].The latest version of the artifact will be used when no version isspecified.expressionUser property: expressionAn expression to evaluate instead of prompting. Note that this must notinclude the surrounding ${...}.forceStdout (Default: false)User property: forceStdoutThis options gives the option to output information in cases where theoutput has been suppressed by using -q (quiet option) in Maven. This isuseful if you like to use maven-help-plugin:evaluate in a script call(for example in bash) like this:RESULT=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)echo $RESULTThis will only printout the information which has been requested byexpression to stdout.outputUser property: outputOptional parameter to write the output of this help in a given file,instead of writing to the console. This parameter will be ignored if noexpression is specified.Note: Could be a relative path.help:helpDescription: Display help information on maven-help-plugin.Call mvn help:help -Ddetail=true -Dgoal=<goal-name> to display parameterdetails.Implementation: org.apache.maven.plugins.help.HelpMojoLanguage: javaAvailable parameters:detail (Default: false)User property: detailIf true, display all settable properties for each goal.goalUser property: goalThe name of the goal for which to show help. If unspecified, all goalswill be displayed.indentSize (Default: 2)User property: indentSizeThe number of spaces per indentation level, should be positive.lineLength (Default: 80)User property: lineLengthThe maximum length of a display line, should be positive.help:systemDescription: Displays a list of the platform details like system propertiesand environment variables.Implementation: org.apache.maven.plugins.help.SystemMojoLanguage: javaAvailable parameters:outputUser property: outputOptional parameter to write the output of this help in a given file,instead of writing to the console.Note: Could be a relative path.[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.904 s
[INFO] Finished at: 2021-10-12T15:53:53+08:00
[INFO] ------------------------------------------------------------------------

5.查看指定目标

可以通过-Dgoal参数,
查看指定目标的详细信息:

简略信息:
mvn help:describe -Dplugin=help -Dgoal=describe
详细信息:
mvn help:describe -Dplugin=help -Dgoal=describe -Ddetail

简略信息输出如下:

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-help-plugin:3.2.0:describe (default-cli) @ standalone-pom ---
[INFO] Mojo: 'help:describe'
help:describeDescription: Displays a list of the attributes for a Maven Plugin and/orgoals (aka Mojo - Maven plain Old Java Object).For more information, run 'mvn help:describe [...] -Ddetail'[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.031 s
[INFO] Finished at: 2021-10-12T15:56:50+08:00
[INFO] ------------------------------------------------------------------------

详细信息输出如下:

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-help-plugin:3.2.0:describe (default-cli) @ standalone-pom ---
[INFO] Mojo: 'help:describe'
help:describeDescription: Displays a list of the attributes for a Maven Plugin and/orgoals (aka Mojo - Maven plain Old Java Object).Implementation: org.apache.maven.plugins.help.DescribeMojoLanguage: javaAvailable parameters:artifactIdUser property: artifactIdThe Maven Plugin artifactId to describe.Note: Should be used with groupId parameter.cmdUser property: cmdA Maven command like a single goal or a single phase following the Mavencommand line:mvn [options] [<goal(s)>] [<phase(s)>]detail (Default: false)User property: detailThis flag specifies that a detailed (verbose) list of goal (Mojo)information should be given.goalUser property: goalThe goal name of a Mojo to describe within the specified Maven Plugin. Ifthis parameter is specified, only the corresponding goal (Mojo) will bedescribed, rather than the whole Plugin.groupIdUser property: groupIdThe Maven Plugin groupId to describe.Note: Should be used with artifactId parameter.minimal (Default: false)User property: minimalThis flag specifies that a minimal list of goal (Mojo) information shouldbe given.outputUser property: outputOptional parameter to write the output of this help in a given file,instead of writing to the console.Note: Could be a relative path.pluginAlias: prefixUser property: pluginThe Maven Plugin to describe. This must be specified in one of threeways:1.  plugin-prefix, i.e. 'help'2.  groupId:artifactId, i.e. 'org.apache.maven.plugins:maven-help-plugin'3.  groupId:artifactId:version, i.e.'org.apache.maven.plugins:maven-help-plugin:2.0'versionUser property: versionThe Maven Plugin version to describe.Note: Should be used with groupId/artifactId parameters.[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.162 s
[INFO] Finished at: 2021-10-12T15:57:13+08:00
[INFO] ------------------------------------------------------------------------

6.其他命令

该帮助插件还有很多有用的goal,
下面仅列出几个常用的,
更多的请自行尝试。

查看当前pom.xml具体生效的结果,
并且输出到文件:

mvn help:effective-pom -Doutput=EffectivePom.xml

查看pom中生效的profile:

mvn help:active-profiles -N

查看系统所有环境变量:

mvn help:system

7.参考文章

maven 插件help帮助命令maven查看插件帮助


http://www.taodudu.cc/news/show-1250945.html

相关文章:

  • SpringBoot脚手架工程快速搭建
  • SpringBoot集成MyBatis-Plus分页插件
  • SNMP客户端工具MIB Browser
  • PowerDesigner运行自定义VBS脚本,复制Name到Comment
  • BitMap-BitSet(JDK1.8)基本使用入门
  • IDEA查看Java类的UML关系图
  • 30. 包含min函数的栈
  • 35. 复杂链表的复制
  • 58 - II. 左旋转字符串
  • 03. 数组中重复的数字
  • 53 - II. 0~n-1中缺失的数字
  • 04. 二维数组中的查找
  • 11. 旋转数组的最小数字
  • 50. 第一个只出现一次的字符
  • 32 - I. 从上到下打印二叉树
  • 32 - II. 从上到下打印二叉树 II
  • 32 - III. 从上到下打印二叉树 III
  • 26. 树的子结构
  • PostgreSQL数据库密码
  • SpringBoot中使用Hibernate Validator校验工具类
  • 28. 对称的二叉树
  • 解决tomcat的undeploy
  • 解决eclipse出现The superclass javax.servlet.http.HttpServlet was not found on the Java Build Path
  • 下载安装neo4j
  • vue-drag-resize实线页面的拖拽与缩放
  • 解决IDEA不能编译XML文件
  • 播放视频和音频文件java
  • 实时获取屏幕大小
  • vue部分样式无法修改
  • vue中根据搜索内容跳转到页面指定位置

Maven查看插件信息相关推荐

  1. java plugin 安装_eclipse maven plugin 插件 安装 和 配置

    Posted on 2012-07-13 12:40 fancydeepin 阅读(96246) 评论(45)  编辑  收藏  所属分类: Maven3 Guide 环境准备: eclipse(He ...

  2. maven 版本号插件_测试Maven版本插件自动递增版本号

    maven 版本号插件 抽象 Maven版本插件是一个非常强大的工具,我在很大程度上依赖于它来协调软件版本. 通常,软件发行版本号遵循简单的1.0.0.0-SNAPSHOT格式. 但是最近我需要在版本 ...

  3. 构建maven项目插件_如何构建一个Maven插件

    构建maven项目插件 使用Okta的身份管理平台轻松部署您的应用程序 使用Okta的API在几分钟之内即可对任何应用程序中的用户进行身份验证,管理和保护. 今天尝试Okta. 由于其插件生态系统的普 ...

  4. 测试Maven版本插件自动递增版本号

    抽象 Maven版本插件是一个非常强大的工具,我在很大程度上依赖于它来协调软件版本. 通常,软件发行版本号遵循简单的1.0.0.0-SNAPSHOT格式. 但是最近我需要在版本号中添加限定符-类似于1 ...

  5. eclipse maven plugin 插件安装和配置

    2019独角兽企业重金招聘Python工程师标准>>> 环境准备: eclipse(Helios) 3.6 maven 3.0.4 maven3 安装: 安装 Maven 之前要求先 ...

  6. eclipse maven plugin 插件 安装 和 配置

    本文转自:http://www.blogjava.net/fancydeepin/archive/2012/07/13/eclipse_maven3_plugin.html maven3 安装: 安装 ...

  7. Maven Assembly插件 使用与标签介绍

    Maven Assembly插件 使用与标签介绍 一.介绍 Assembly 插件的主要作用是,允许用户将项目输出与它的依赖项.模块.站点文档.和其他文件一起组装成一个可分发的归档文件. 二.常见的m ...

  8. IDEA插件系列(3):Maven Helper插件

    一.引言 在写Java代码的时候,我们可能会出现Jar包的冲突的问题,这时候就需要我们去解决依赖冲突了,而解决依赖冲突就需要先找到是那些依赖发生了冲突,当项目比较小的时候,还比较依靠IEDA的[Dia ...

  9. IDEA Maven Helper插件(详细使用教程)

    一.引言 在写Java代码的时候,我们可能会出现Jar包的冲突的问题,这时候就需要我们去解决依赖冲突了,而解决依赖冲突就需要先找到是那些依赖发生了冲突,当项目比较小的时候,还比较依靠IEDA的[Dia ...

最新文章

  1. linux查看软件包信息,Linux查看系统信息的一些命令及查看已安装软件包的命令...
  2. (8) Xamarin使用Jar檔
  3. 闪存我自己来——HDS公布闪存路线图
  4. 如何减少tomcat内存使用量?
  5. ai算子是什么_肇观电子刷新端侧AI芯片性能记录并发布“5分钟部署”AI开发平台 - 企业资讯...
  6. 【机器学习】数据不平衡问题都怎么解?
  7. 关于引进制转换(凌乱)
  8. Cobbler部署之FAQ处理
  9. 一个程序员送给大学生的一些话
  10. python计算凸包并绘制凸包曲线
  11. Python的hasattr(),getattr(),setattr()
  12. ps安装插件提示“无法加载扩展,因为它未正确签署”解决方法
  13. Glance - 直接操作image
  14. can't connect local MySql Server though socket /tmp如何解决
  15. iOS 录音,播放并上传
  16. 部署描述符[D:\apache-tomcat-9.0.38\conf\Catalina\localhost\books.xml]时出错
  17. 中国象棋对局软件设计(一)
  18. windows 云服务器计算器,windows7 云主机
  19. 使用Phaser开发你的第一个H5游戏(一)
  20. python 将列表按指定长度拆分

热门文章

  1. python 线程间通信之Condition, Queue
  2. iOS学习:CAShapeLayer与DrawRect对比,与UIBezierPath画图形
  3. 20140704笔试面试总结(java)
  4. Android之AsyncTask学习笔记
  5. [iOS Animation]-CALayer 变换
  6. 《CSS基础教程》 读书笔记二
  7. 提升安全性WindowsXP必禁的十大服务
  8. [HTTP] HTTP协议基础及发展历史
  9. JavaScript(七)—— BOM 浏览器对象模型
  10. 客户区和非客户区指的什么?窗口客户区和视图客户区的区别(小问题大思想)