Alex Rivera | Logout

Maven command to list lifecycle phases along with bound goals?

Asked 2009-11-10T17:16:52.407
144

I'm just learning Maven, and so this might be obvious, but I can't find an easy way to list the goals associated for each maven lifecycle phase for a given project.

I saw that the Maven default life cycle phases and corresponding default goals are documented here. My understanding so far is that each pom.xml can bind additional goals to each lifecycle phase.

So, is there a mvn command to determine the goals that will be run for each lifecycle phase for a given project? If not, I guess I just have to look through the pom.xml for each new maven project to figure this out?

Edit
Report

1 Answer

19

One tool that helps is mvn help:effective-pom It will print the POM with all variables and all parent POMs expanded. This helps to understand what Maven sees. From that, it's pretty simple to find all the additional goals (which usually aren't that many).

The bigger problem is the implicit goals (i.e. when a plugin hooks itself to some phases of the lifecycle automatically). There is no easy way to see these without actually running Maven. This should become better in Maven 3. Until then, run Maven with -X which will print a whole lot of debug output plus the current phase and which plugins are executed.

answered 2009-11-10T17:24:14.933

Your Answer