Sunday, June 07, 2015

List Maven POMs phases and goals bounds to the phases

For longest time I have wanted to be able to show the actual goals associated with the phases of maven lifecycles. There is the following maven command:

> mvn -B help:describe -Dcmd=deploy

but alas it only lists the static set of goals associated with the phases as specified in the original lifecycle. And then it struck me that m2e add the Lifecycles section to the Maven project's properties page.


So I git cloned the m2e repo  https://git.eclipse.org/r/m2e/m2e-core , looked through the code and
the wrote a small Eclipse plugin fragment to add a command to list the phase and goals into the console. Here is the result.


To use
  • Make sure you have m2e plugins installed into your Eclipse.
  • Then install the fragement from this update site URL:
https://cdn.rawgit.com/sandipchitale/m2e-phasesandgoals/master/org.eclipse.m2e.core.ui.phasesandgoals.updatesite/site.xml
  • Restart Eclipse
  • Select a maven project node and invoke Project > Show Phases and Goals command. You will see the output like above in the Maven Console.
Update

Now displays likely lifecycle and execution ids.

TODO
  • Show the output in a tree view.
  • Allow the user to launch mvn build with the goals associated with a phase.
Github

https://github.com/sandipchitale/m2e-phasesandgoals



No comments: