I have a maven build that is extremely slow. I would like to know whether there is a way to profile maven execution in order to find out which are the most time-consuming steps.
Later I will want to compare these times between builds for older versions (which were faster), so they should be ideally in a format that can be compared/diffed/graphed.
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.
There are three built-in build lifecycles: default, clean and site. The default lifecycle handles your project deployment, the clean lifecycle handles project cleaning, while the site lifecycle handles the creation of your project's web site.
Each lifecycle consists of a sequence of phases.The default build lifecycle consists of 23 phases, as it's the main build lifecycle. On the other hand, the clean life cycle consists of 3 phases, while the site lifecycle is made up of 4 phases.
This is the quickest possible way:
export MAVEN_OPTS="-Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss,SSS \ -Dorg.slf4j.simpleLogger.showDateTime=true" mvn test
Results in
MAVEN_OPTS="-Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss,SSS -Dorg.slf4j.simpleLogger.showDateTime=true" mvn test 17:06:07,330 [INFO] Scanning for projects... 17:06:07,447 [INFO] 17:06:07,447 [INFO] ------------------------------------------------------------------------ 17:06:07,448 [INFO] Building bimble-server 0.0.1-SNAPSHOT 17:06:07,448 [INFO] ------------------------------------------------------------------------ 17:06:07,747 [INFO] 17:06:07,748 [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ bimble-server ---
If you then add that environment variable to your shell's config file (like ~/.bashrc
or ~/.profile
) you will have those timings every time you use Maven.
Based on info from Stanley Hillner's blog:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With