1

有什么方法可以显示所有插件及其目标,这些插件将针对某些命令集执行。

我知道 maven 输出此类信息,但它被其他输出阻塞,提取该信息不是很方便。

4

2 回答 2

3

我找到了plan-maven-plugin。也许你应该试一试(我肯定会,明天)。

于 2013-02-07T18:23:12.430 回答
2

这里有几个命令可以提供帮助:

mvn help:describe -Dcmd=test-compile

将向您展示在您指定的阶段(在本例中test-compile)调用了哪些插件。例如:

anew@Wintermute:example$ mvn help:describe -Dcmd=test-compile | grep test-compile
[INFO] 'test-compile' is a phase corresponding to this plugin:
* test-compile: org.apache.maven.plugins:maven-compiler-plugin:2.3.2:testCompile

也有帮助的是:

mvn help:effective-pom

不出所料,将向您展示 maven 用来执行的有效 pom。如果你有一个父 pom 并且不确定在特定阶段到底发生了什么,这可能是一个很好的方法。这是查看插件的目标已绑定到其<executions/>元素中的某个阶段的最佳方式。

mvn help:describe -Dplugin=groupId:artifactId:version

会给你一些关于插件有什么功能的提示:

anew@Wintermute:example$ mvn help:describe -Dplugin=org.apache.maven.plugins:maven-deploy-plugin:2.5
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building example 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-help-plugin:2.1.1:describe (default-cli) @ pivot-api ---
[INFO] org.apache.maven.plugins:maven-deploy-plugin:2.5

Name: Maven Deploy Plugin
Description: Uploads the project artifacts to the internal remote repository.
Group Id: org.apache.maven.plugins
Artifact Id: maven-deploy-plugin
Version: 2.5
Goal Prefix: deploy

This plugin has 3 goals:

deploy:deploy
  Description: Deploys an artifact to remote repository.

deploy:deploy-file
  Description: Installs the artifact in the remote repository.

deploy:help
  Description: Display help information on maven-deploy-plugin.
    Call
      mvn deploy:help -Ddetail=true -Dgoal=<goal-name>
    to display parameter details.

For more information, run 'mvn help:describe [...] -Ddetail'
于 2013-02-07T20:03:14.627 回答