【Maven】查看插件配置参数

目录

  • 背景
  • 帮助命令
  • 使用举例
  • 查看详细信息
  • 查看指定目标
  • 其他命令

背景

工作中使用到很多的Maven插件,虽然可以从网上拷贝别人的配置来用,但是想要深入了解一个插件一共有哪些可用的配置参数,就无从下手了。

当然可以从插件的官方网站查看帮助手册,也可以通过Mavenhelp命令查看插件帮助,包括插件的简略和详细的描述信息,也可以查看插件所有的目标goal,以及插件的配置参数等。

帮助命令

在命令行下面,使用Mavenhelp: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>

使用举例

下面查看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命令

查看详细信息

通过在命令后追加-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] ------------------------------------------------------------------------

查看指定目标

可以通过-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] ------------------------------------------------------------------------

其他命令

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

  • 查看当前pom.xml具体生效的结果,并且输出到文件: mvn help:effective-pom -Doutput=EffectivePom.xml
  • 查看pom中生效的profile: mvn help:active-profiles -N
  • 查看系统所有环境变量: mvn help:system

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/17251.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Ajax笔记_01(知识点、包含代码和详细解析)

Ajax_01笔记 前置知识点 在JavaScript中 问题1&#xff1a;将数组转为字符串&#xff0c;以及字符串转为数组的方式。 问题2、将对象转为字符串&#xff0c;以及字符串转为对象的方法。 方法&#xff1a; 问题1&#xff1a; 将数组转为字符串可以使用 join() 方法。例如&…

Node.js入门笔记(包含源代码)以及详细解析

Node.js 入门笔记源码 01、如何在终端中执行js 文件 目标&#xff1a;将下面的代码语句在中断中执行 代码演示&#xff1a; console.log(Hello World)for (let i 0;i < 3;i) {console.log(6)}方法&#xff1a;在文件上右击打开在终端中执行&#xff0c;然后输入node空格 输…

关于Python 的 Web 自动化测试的实践

Web 测试是软件测试中比较重要的一个分支&#xff0c;而要实现 Web 自动化测试则要求测试人员能熟练掌握自动化测试工具和编程语言。介绍免费开源的 Web 测试工具 Selenium&#xff0c;以及流行的编程语言 Python。根据自动化测试的原理&#xff0c;对网页元素的常用定位方式&a…

ES6 - Iterator迭代器和for...of 循环

文章目录 前言一、Iterator介绍二、Iterator原理三、实现Iterator接口的原生对象有五、默认调用 Iterator 接口的场合六&#xff0c;for... of 循环七&#xff0c;总结 前言 JavaScript 原有的表示“集合”的数据结构&#xff0c;主要是数组&#xff08;Array&#xff09;和对…

若依框架实现后端防止用户重复点击

若依框架实现后端防止用户重复点击 基于自定义注解、切面、Redis实现 1. 添加自定义注解&#xff1a; 代码放置位置&#xff1a;com/ruoyi/common/annotation/RepeatClick.java time: 时间默认0; unit&#xff1a;单位默认 秒; key: 默认空字符串 package com.ruoyi.fra…

Qt Creator 11 开放源码集成开发环境新增集成终端和 GitHub Copilot 支持

导读Qt 项目今天发布了 Qt Creator 11&#xff0c;这是一款开源、免费、跨平台 IDE&#xff08;集成开发环境&#xff09;软件的最新稳定版本&#xff0c;适用于 GNU/Linux、macOS 和 Windows 平台。 Qt Creator 11 的亮点包括支持标签、多外壳、颜色和字体的集成终端模拟器&am…

【微信小程序创作之路】- 小程序事件绑定、动态提示Toast、对话框 Modal

【微信小程序创作之路】- 小程序事件绑定、动态提示Toast、对话框 Modal 第六章 小程序事件绑定、动态提示Toast、对话框 Modal 文章目录 【微信小程序创作之路】- 小程序事件绑定、动态提示Toast、对话框 Modal前言一、事件是什么&#xff1f;二、小程序中常用事件三、事件传…

2023年受人欢迎的低代码开发平台大盘点

随着企业对于降低成本和加快软件开发的需求增加&#xff0c;低代码开发平台逐渐成为一种受欢迎的选择。这些平台提供了拖放界面和预置组件&#xff0c;使得开发人员可以用更少的代码创建复杂的应用软件。低代码开发平台不仅有助于企业加速数字化转型&#xff0c;而且还能打破业…

URP基于GL的Unity物体网格线绘制方法参考

直接上代码&#xff1a; using System; using System.Collections.Generic; using UnityEngine; using UnityEngine.Rendering;public class GLWireMesh : MonoBehaviour {[Serializable]public class IntPair{public int a;public int b;public IntPair(int a, int b){this.a…

Linux系统管理:虚拟机Rocky Linux安装

目录 一、理论 1.Rocky Linux 2.NetworkManager配置 3.ipaddress 配置文件 4.nmtui 配置 ipaddress 二、实验 1.虚拟机Rocky Linux安装准备阶段 2.安装Rocky Linux 3.进入系统 三、问题 1.网络配置文件权限不够 一、理论 1.Rocky Linux &#xff08;1&#xff0…

下载的谷歌模型如何转为3dtiles

收费工具&#xff0c;学生党勿扰 收费金额1000元 已经购买过工具的大佬&#xff0c;可以免费更新 1 概述 上个月&#xff0c;写了一篇<<谷歌地图模型自动下载>>的文章&#xff0c;效果还不错&#xff0c;能够帮到一些同学。 但是&#xff0c;随着谷歌模型下载的越…

uniapp开发微信小程序--自定义顶部导航栏

一、实现效果&#xff1a; 二、代码实现&#xff1a; 1.在pages.json文件中&#xff0c;单页面定义导航栏&#xff0c;添加以下代码&#xff1a; "navigationStyle": "custom" //自定义导航栏如图所示&#xff1a; 2.在components文件夹下&#xff0c;…

使用多数据源dynamic-datasource-spring-boot-starter遇到的问题记录

记录使用多数据源dynamic-datasource-spring-boot-starter遇到的问题&#xff1a; 1、工程启动失败 缺少clickhouse连接驱动&#xff0c;引入对应的maven依赖 <!--ck连接驱动--><dependency><groupId>ru.yandex.clickhouse</groupId><artifactId>…

【python】数据可视化开发

数据可视化开发 折线图json数据格式python数据和json数据的相互转换 pyecharts模块构建基础折线图全局配置选项set_global_opts方法 数据处理完成折线图 地图动态柱状图二级目录三级目录 折线图 json数据格式 一种轻量级的数据交互模式&#xff0c;可以按照JSON指定的格式去组…

Kylin v10基于cephadm工具离线部署ceph分布式存储

1. 环境&#xff1a; ceph&#xff1a;octopus OS&#xff1a;Kylin-Server-V10_U1-Release-Build02-20210824-GFB-x86_64、CentOS Linux release 7.9.2009 2. ceph和cephadm 2.1 ceph简介 Ceph可用于向云平台提供对象存储、块设备服务和文件系统。所有Ceph存储集群部署都从…

自然语言处理从入门到应用——LangChain:提示(Prompts)-[提示模板:连接到特征存储]

分类目录&#xff1a;《自然语言处理从入门到应用》总目录 特征存储是传统机器学习中的一个概念&#xff0c;它确保输入模型的数据是最新和相关的。在考虑将LLM应用程序投入生产时&#xff0c;这个概念非常重要。为了个性化LLM应用程序&#xff0c;我们可能希望将LLM与特定用户…

制作crate并发布到Crates.io

准备 发布 crate 时, 一旦发布无法修改,无法覆盖, 因此要注意邮箱等一些个人信息 访问crates.io 的 帐号设定页面[1],生成Token 并在命令行 执行 cargo login your token 此命令将告诉 Cargo 你的 API 令牌, 并将其存储在本地 ~/.cargo/credentials crates.io 上crate的名字, 会…

生成测试报告就万事大吉了吗?NO,升职加薪就差这一步啦!- 04(非常详细,非常实用)

简介 上一篇生成测试报告&#xff0c;小伙伴们和童鞋们就又问道&#xff0c;测试报告已经生成了&#xff0c;怎么发送给相关的负责人了&#xff1f;小伙伴们和童鞋们不要着急&#xff0c;慢慢给你道来&#xff0c;心急吃不了热豆腐哈。这些小伙伴们的表现还是不错的&#xff0c…

安装nvm之后,node -v 提示‘node‘ 不是内部或外部命令,也不是可运行的程序 或批处理文件

1. 检查有没有执行这个命令&#xff1a;nvm use [nodejs version name] 2. 检查nvm安装位置同级&#xff0c;有没有nodejs文件夹&#xff0c;是一个快捷键&#xff01;如果有一个其他的nodejs&#xff0c;把它删掉&#xff0c;然后到cmd中&#xff0c;重新nvm install一下&…

【计算机网络】应用层协议 -- 安全的HTTPS协议

文章目录 1. 认识HTTPS2. 使用HTTPS加密的必要性3. 常见的加密方式3.1 对称加密3.2 非对称加密3.3 非对称加密对称加密 4. 引入CA证书4.1 CA认证4.2 数据签名4.3 非对称机密对称加密证书认证4.4 常见问题 5. 总结 1. 认识HTTPS HTTPS全称为 Hyper Text Tranfer Protocol over …