How can I tell what phase a plugin will run in?

intellij-idea, java, maven

Solution

You can let maven print out informations regarding the plugin using mavens help plugin - for enunciate simply use the following command:

`mvn help:describe -Dplugin=org.codehaus.enunciate:maven-enunciate-plugin -Ddetail`

It has actually 6 goals bound to different phases - goal `docs` will be bound to `process-sources`-phase

To only extract the goal you are interested in you can furthermore use the following command:

`mvn help:describe -Dmojo=docs -DgroupId=org.codehaus.enunciate -DartifactId=maven-enunciate-plugin -Ddetail`

You could also omit the `-Ddetail` part, but it won't give you then any information on the phase it is running.

Problem

I'm using a plugin in my pom that looks like this: ``` <plugin> <groupId>org.codehaus.enunciate</groupId> <artifactId>maven-enunciate-plugin</artifactId> <!-- check for the latest version --> <version>1.27</version> <executions> <execution> <goals> <goal>docs</goal> </goals> <configuration> <docsDir>${project.build.directory}/docs</docsDir> </configuration> </execution> </executions> </plugin> ``` And I'm wondering, if I run `package` will this plugin run or is it during `site` or something else? Is there an easy way to tell by looking at this, or do I have to either - Read the plugin documentation - Experiment through trial and error I'm hoping there's an easier way. I'm using intellij-idea, if that provides a means I'd be happy with that. Assuming I can't tell without one of these two methods, is it a best practice to always define the phase in the pom so that I can save myself and others time in the future?

Original source