Maven doesn't give you detailed information about where your build is taking the most time. This build time extension
displays the duration for each goal that is run during your build.
Usage
Put this in your pom.xml to find out why you are slow.
By default this will log only to maven debug -X,--debug, however debug is quite noisy, so you can enable output to normal log
via the property buildtime.output.log in your pom or via commandline -Dbuildtime.output.log=true.
Capture the results to a CSV file
Thanks to @leonard84 for the contribution. You'll need to set a property to enable this feature.
Eventually, we can enhance this functionality to include other output formats.
I personally would like to publish the results to an InfluxDb instance.
Maven introduced slf4j in version 3.2 which broke this build extension for Maven 3.0 users.
Version 2.0+ will work with the latest version of Maven.
Maven 3.3 - Use version 3.0+
With version 3.0.0 we switched to Maven's EventSpy API which increases the compatibility with other tools, e.g. Jenkins which
also use this API to instrument Maven. However this requires a different way of loading the extension. This also requires at
least Maven 3.3+.
Create the following file <projectroot>/.mvn/extensions.xml with this as content
Due to MNG-5786 you might need to use Maven 3.3.9 if
<projectroot>/.mvn/extensions.xml is not picked up. You can also check the build log for the presence of the string
BuildTimeEventSpy is registered. which is logged if the extension was successfully activated.
Instead of modifying the POM you can also perform a one-off execution. In this
case you must manually download the extension (only once, before the first
execution) and then explicitly provide it as a command line argument:
请发表评论