配置描述目标

下面是help:describe目标的其他配置示例。

插件参数_

plugin参数旨在提供两件事:方便和基于前缀的访问。

通过groupId:artifactIdgroupId:artifactId:version指定插件时会很方便。更传统的单独字段规范意味着指定以下内容:

# mvn help:describe -DgroupId=org.somewhere -DartifactId=some-plugin -Dversion=0.0.0

插件参数的使用允许这样做:

# mvn help:describe -Dplugin=org.somewhere:some-plugin:0.0.0

以下是描述帮助插件的示例:

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

注意版本在这里始终是可选的。

另一方面, plugin 参数还提供了通过前缀指定插件的选项,如下所示:

# mvn help:describe -Dplugin=help

目标参数_

您可以使用描述目标的目标参数来显示或显示有关您指定的插件的特定目标的相关信息。

例如,当您执行以下命令时:

# mvn help:describe -Dgoal=describe -DgroupId=org.apache.maven.plugins -DartifactId=maven-help-plugin

这将仅显示有关描述目标的简要信息。

cmd参数_

您还可以要求一个 Maven 命令,即一个目标或一个阶段或一个生命周期。它是调用 Maven 时的命令,即:

# mvn -help

usage: mvn [options] [<goal(s)>] [<phase(s)>]
...

以下是一些示例:

# mvn help:describe -Dcmd=clean
...
[INFO] [help:describe]
[INFO] 'clean' is a lifecycle with the following phases:
* pre-clean: NOT DEFINED
* clean: org.apache.maven.plugins:maven-clean-plugin:clean
* post-clean: NOT DEFINED
...
# mvn help:describe -Dcmd=compile
...
[INFO] [help:describe]
[INFO] 'compile' is a phase corresponding to this plugin:
org.apache.maven.plugins:maven-compiler-plugin:compile

It is a part of the lifecycle for the POM packaging 'jar'. This lifecycle includes the following phases:
* validate: NOT DEFINED
* initialize: NOT DEFINED
* generate-sources: NOT DEFINED
* process-sources: NOT DEFINED
* generate-resources: NOT DEFINED
* process-resources: org.apache.maven.plugins:maven-resources-plugin:resources
* compile: org.apache.maven.plugins:maven-compiler-plugin:compile
* process-classes: NOT DEFINED
* generate-test-sources: NOT DEFINED
* process-test-sources: NOT DEFINED
* generate-test-resources: NOT DEFINED
* process-test-resources: org.apache.maven.plugins:maven-resources-plugin:testResources
* test-compile: org.apache.maven.plugins:maven-compiler-plugin:testCompile
* process-test-classes: NOT DEFINED
* test: org.apache.maven.plugins:maven-surefire-plugin:test
* package: org.apache.maven.plugins:maven-jar-plugin:jar
* pre-integration-test: NOT DEFINED
* integration-test: NOT DEFINED
* post-integration-test: NOT DEFINED
* verify: NOT DEFINED
* install: org.apache.maven.plugins:maven-install-plugin:install
* deploy: org.apache.maven.plugins:maven-deploy-plugin:deploy
...
# mvn help:describe -Dcmd=compiler:compile
...
[INFO] 'compiler:compile' is a plugin goal (aka mojo).
Mojo: 'compiler:compile'
compiler:compile
  Description: Compiles application sources
  Deprecated. No reason given

For more information, run 'mvn help:describe [...] -Ddetail'
...

最小详细参数_

如果要显示更少或更详细的信息,可以使用minimumdetail参数。

minimum参数添加了一个最小信息列表:

# mvn help:describe -Dplugin=help -Dminimal=true
...
[INFO] [help:describe]
[INFO] org.apache.maven.plugins:maven-help-plugin:2.1-SNAPSHOT
Group Id: org.apache.maven.plugins
Artifact Id: maven-help-plugin
Version: 2.1-SNAPSHOT
Goal Prefix: help
Description: The Maven Help plugin provides goals aimed at helping to make
  sense out of the build environment. It includes the ability to view the
  effective POM and settings files, after inheritance and active profiles have
  been applied, as well as a describe a particular plugin goal to give usage
  information.

For more information, run 'mvn help:describe [...] -Ddetail'
...

如果您不提供参数表,则会添加一个列表,其中包含插件的 mojos 及其描述:

# mvn help:describe -Dplugin=help
...
[信息] org.apache.maven.plugins:maven-help-plugin:2.1-SNAPSHOT
组 ID:org.apache.maven.plugins
工件 ID:maven-help-plugin
版本:2.1-快照
目标前缀:帮助
描述:Maven Help 插件提供的目标旨在帮助
  从构建环境中感知。它包括查看
  有效的 POM 和设置文件,在继承和活动配置文件之后
  已应用,以及描述特定的插件目标以提供使用
  信息。

这个插件有 9 个目标:

帮助:活动配置文件
  说明:显示当前处于活动状态的配置文件列表
    这个构建。
  已弃用。没有给出理由

帮助:所有配置文件
  说明:显示当前可用配置文件的列表
    项目。
    注意:它将列出项目的所有配置文件。如果配置文件出现
    status inactive 那么可能需要设置配置文件激活
    开关/属性。
  已弃用。没有给出理由

帮助:描述
  描述:显示 Maven 插件和/或的属性列表
    Mojo(Maven 普通旧 Java 对象)。
  已弃用。没有给出理由

帮助:有效的pom
  描述:将有效的 POM 显示为此构建的 XML,带有
    活动配置文件考虑在内。
  已弃用。没有给出理由

帮助:有效设置
  说明:将此项目的计算设置显示为 XML,
    鉴于任何配置文件增强和全局设置的继承
    进入用户级设置。
  已弃用。没有给出理由

帮助:评估
  描述:评估用户给出的 Maven 表达式
    交互模式。
  已弃用。没有给出理由

帮助:帮助
  说明:显示关于 maven-help-plugin 的帮助信息。
    称呼
     mvn help:help -Ddetail=true -Dgoal=<目标名称>
    显示参数详细信息。
  已弃用。没有给出理由

帮助:系统
  描述:显示平台详细信息列表,如系统属性
    和环境变量。
  已弃用。没有给出理由

有关更多信息,请运行“mvn help:describe [...] -Ddetail”
...

detail参数还显示有关目标实现、其参数和组件要求等信息。

# mvn help:describe -Dplugin=help -Ddetail=true

输出参数_

描述目标可以使用可选的输出参数将输出重定向到文件。这是一个例子:

# mvn help:describe -Dplugin=help -Ddetail=true -Doutput=/path/to/file