除了访问在线的插件文档之外,还可以借助maven-help-plugin来获取插件的详细信息。可以运行如下命令来获取maven-compiler-plugin2.1版本的信息:
mvn help:describe -Dplugin=org.apache.maven.plugins:maven-compiler-plugin:2.1
这里执行的是maven-help-plugin的describe目标,在参数plugin中输入需要描述插件的groupId,artifactId和version。maven在命令行输出maven-help-plugin的简要信息,包括该插件的坐标,目标前缀和目标等,如下:
Name: Maven Compiler Plugin
Description: The Compiler Plugin is used to compile the sources of your
project.
Group Id: org.apache.maven.plugins
Artifact Id: maven-compiler-plugin
Version: 2.1
Goal Prefix: compiler
This plugin has 3 goals:
compiler:compile
Description: Compiles application sources
compiler:help
Description: Display help information on maven-compiler-plugin.
Call
mvn compiler:help -Ddetail=true -Dgoal=<goal-name>
to display parameter details.
compiler:testCompile
Description: Compiles application test sources.
For more information, run 'mvn help:describe [...] -Ddetail'
对于坐标和插件目标,不再多做解释。这里值得一提的是目标前缀(Goal Prefix),其作用是方便在命令行直接运行插件。maven-compiler-plugin的目标前缀是compiler。
在描述插件的时候,还可以省去版本信息,让Maven自动获取最新版本来进行表述,例如:
$ mvn help:describe -Dplugin=org.apache.maven.plugins:maven-compiler-plugin
进一步简化,可以使用插件目标前缀替换坐标:
$ mvn help:describe -Dplugin=compiler
如果想仅仅描述某个插件目标的信息,可以加上goal参数:
$ mvn help:describe -Dplugin=compiler -Dgoal=compile
如果想让maven-help-plugin输出更详细的信息,可以加上detail参数:
$ mvn help:describe -Dplugin=compiler -Ddetail
1716

被折叠的 条评论
为什么被折叠?



