如何检索任何 Maven 插件的所有可能配置

Iri*_*ina 2 java intellij-idea maven

在 pom.xml 中有一段针对指定 Maven 插件的配置:

<plugin>
                ...
                <configuration>
                    <param1>true</param1>
                    ...
                    <param10>value</param1>
                </configuration>
</plugn>
Run Code Online (Sandbox Code Playgroud)

如何检索所有可能的参数以及指定插件的值限制?换句话说,我需要检索 param1、param2...param10 的名称。

我有 IntelliJ,但它没有对此的提示。

目前我会上网阅读该插件的文档。但我认为,这并不是最好的选择。

dav*_*xxx 6

您可以help:describe通过指定detail属性来使用目标。

例如,获取 Maven 编译器插件的完整描述:

mvn 帮助:描述 -Dplugin=org.apache.maven.plugins:maven-compiler-plugin -Ddetail

如果您只想获得有关插件特定目标的文档,则可以使用goal目标值指定属性。

例如,要获取compileMaven 编译器插件目标的完整描述:

mvn帮助:描述-Dplugin = org.apache.maven.plugins:maven-compiler-plugin -Dgoal =编译-Ddetail

以下是 Maven 帮助插件描述目标的官方文档:

http://maven.apache.org/plugins/maven-help-plugin/describe-mojo.html

您当然可以通过插件本身获取它:

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

您将得到输出:

help:describe
  Description: Displays a list of the attributes for a Maven Plugin and/or
    goals (aka Mojo - Maven plain Old Java Object).
  Implementation: org.apache.maven.plugins.help.DescribeMojo
  Language: java

Available parameters:

artifactId
  User property: artifactId
  The Maven Plugin artifactId to describe.
  Note: Should be used with groupId parameter.

cmd
  User property: cmd
  A Maven command like a single goal or a single phase following the Maven
  command line:
  mvn [options] [<goal(s)>] [<phase(s)>]

detail (Default: false)
  User property: detail
  This flag specifies that a detailed (verbose) list of goal (Mojo)
  information should be given.

goal
  User property: goal
  The goal name of a Mojo to describe within the specified Maven Plugin. If
  this parameter is specified, only the corresponding goal (Mojo) will be
  described, rather than the whole Plugin.

groupId
  User property: groupId
  The Maven Plugin groupId to describe.
  Note: Should be used with artifactId parameter.

medium (Default: true)
  User property: medium
  This flag specifies that a medium list of goal (Mojo) information should
  be given.

minimal (Default: false)
  User property: minimal
  This flag specifies that a minimal list of goal (Mojo) information should
  be given.

output
  User property: output
  Optional parameter to write the output of this help in a given file,
  instead of writing to the console.
  Note: Could be a relative path.

plugin
  User property: plugin
  The Maven Plugin to describe. This must be specified in one of three
  ways:

  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'

version
  User property: version
  The Maven Plugin version to describe.
  Note: Should be used with groupId/artifactId parameters.
Run Code Online (Sandbox Code Playgroud)

以下是它的一些使用示例:

http://maven.apache.org/plugins/maven-help-plugin/examples/describe-configuration.html