Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visualize all Maven phases, goals, profiles, and plugins

Tags:

maven

Is there a way print a graph or simple chart of all the phases, goals, profiles, and plugins running during a given run of Maven? It seems like this would be useful to see a big picture of what is going on. I know you can turn on debug mode via -X, but I'm looking for something more concise. Specifically to show which plugins are running in which phases, but showing all goals, phases, and profiles would be useful as well.

like image 355
xdhmoore Avatar asked Jan 05 '17 19:01

xdhmoore


People also ask

What are Maven phases and goals?

Here are some of the phases and default goals bound to them: compiler:compile – the compile goal from the compiler plugin is bound to the compile phase. compiler:testCompile is bound to the test-compile phase. surefire:test is bound to the test phase.

What is Maven list its phases or life cycle?

Maven makes the day-to-day work of Java developers easier and helps with the building and running of any Java-based project. Maven Lifecycle: Below is a representation of the default Maven lifecycle and its 8 steps: Validate, Compile, Test, Package, Integration test, Verify, Install and Deploy.

What is goal and profile in Maven build?

A Build profile is a set of configuration values, which can be used to set or override default values of Maven build. Using a build profile, you can customize build for different environments such as Production v/s Development environments.

How many phases are there in Maven?

This is the primary life cycle of Maven and is used to build the application. It has the following 21 phases.


1 Answers

You can use buildplan-maven-plugin, which has the goal list-phase for displaying plugin executions within lifecycle phases.

mvn fr.jcgay.maven.plugins:buildplan-maven-plugin:list-phase

You can run this for a specific profile: just tack on -P profile-name.

Example output on an empty Maven project:

process-resources ---------------------------------------------------
    + maven-resources-plugin | default-resources     | resources
compile -------------------------------------------------------------
    + maven-compiler-plugin  | default-compile       | compile
process-test-resources ----------------------------------------------
    + maven-resources-plugin | default-testResources | testResources
test-compile --------------------------------------------------------
    + maven-compiler-plugin  | default-testCompile   | testCompile
test ----------------------------------------------------------------
    + maven-surefire-plugin  | default-test          | test
package -------------------------------------------------------------
    + maven-jar-plugin       | default-jar           | jar
install -------------------------------------------------------------
    + maven-install-plugin   | default-install       | install
deploy --------------------------------------------------------------
    + maven-deploy-plugin    | default-deploy        | deploy
like image 58
approxiblue Avatar answered Oct 08 '22 02:10

approxiblue