michael nesterenko
michael nesterenko

Reputation: 14449

maven build execution tree

Are there any way to show all plugins and their goals that will be executed for some command set.

I know maven outputs such information but it is clogged with other output and it is not very convenient to extract that information.

Upvotes: 1

Views: 346

Answers (2)

Andrew Logvinov
Andrew Logvinov

Reputation: 21851

I found the plan-maven-plugin. Maybe you should give it a try (I definitely will, tomorrow).

Upvotes: 3

Anew
Anew

Reputation: 5532

There's a couple commands that can help here:

mvn help:describe -Dcmd=test-compile

Will show you what plugins are invoked at the phase you specify (in this case test-compile). For example:

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

Also helpful are:

mvn help:effective-pom

Will show you, unsurprisingly the effective pom that maven uses to execute. This can be a good way to poke around if you have a parent pom and aren't sure what exactly happens at a specific phase. This is the best way to see what plugins's goals have been bound to a phase in their <executions/> element.

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

Will give you some hints as to what features plugins have:

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'

Upvotes: 2

Related Questions