下面是help:describe目标的其他配置示例。
plugin参数旨在提供两件事:方便和基于前缀的访问。
通过groupId:artifactId或groupId: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
您可以使用describe目标的mojo参数来显示或显示有关您指定的插件的特定目标的相关信息。
例如,当您执行以下命令时:
# mvn help:describe -Dmojo=describe -DgroupId=org.apache.maven.plugins -DartifactId=maven-help-plugin
这将仅显示有关描述目标的简要信息。
您还可以要求一个 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' ...
如果要显示更少或更详细的信息,可以使用minimum、medium或full参数。
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' ...
medium参数是自 2.1 以来的默认值,并添加了一个包含插件的 mojos 及其描述的列表:
# mvn help:describe -Dplugin=help ... [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. This plugin has 9 goals: help:active-profiles Description: Displays a list of the profiles which are currently active for this build. Deprecated. No reason given help:all-profiles Description: Displays a list of available profiles under the current project. Note: it will list all profiles for a project. If a profile comes up with a status inactive then there might be a need to set profile activation switches/property. Deprecated. No reason given help:describe Description: Displays a list of the attributes for a Maven Plugin and/or Mojo (Maven plain Old Java Object). Deprecated. No reason given help:effective-pom Description: Displays the effective POM as an XML for this build, with the active profiles factored in. Deprecated. No reason given help:effective-settings Description: Displays the calculated settings as XML for this project, given any profile enhancement and the inheritance of the global settings into the user-level settings. Deprecated. No reason given help:evaluate Description: Evaluates Maven expressions given by the user in an interactive mode. Deprecated. No reason given help:expressions Description: Displays the supported Plugin expressions used by Maven. Deprecated. No reason given help:help Description: Display help information on maven-help-plugin. Call mvn help:help -Ddetail=true -Dgoal=<goal-name> to display parameter details. Deprecated. No reason given help:system Description: Displays a list of the platform details like system properties and environment variables. Deprecated. No reason given For more information, run 'mvn help:describe [...] -Ddetail' ...
full参数还显示有关 mojos的实现、它们的参数和组件要求等信息。
# mvn help:describe -Dplugin=help -Dfull=true
注意:medium参数是在 2.0.2 版本中添加的,minimal参数是在本帮助插件的 2.1 版本中添加的。
此描述目标可以使用可选的输出参数将输出重定向到文件。这是一个例子:
# mvn help:describe -Dplugin=help -Ddetail=true -Doutput=/path/to/file