Know your build - so you can make it faster
Maven Build Scanner is a tool that hooks into Maven builds and produces reports and charts that breakdown the time Maven spends doing different tasks. These reports provide insights into your builds that can be used to tune it.
It's been designed to work with large and complex builds; ones with hundreds of modules and plugins.
At Intuit it helped take a 40m build run by hundreds of developers every day and reduce it to 4m - a 10x reduction. Read a blog post on the techniques that saved all this time.
(30m of engineering time) * (several hundred engineers) * (every working day for 5 years) * (some dollar amount) = (a LOT of money saved)
Using the build scanner requires three steps:
- Integrating the build scanner as a maven extension
- Running your build
- Running the server to browse the statistics
Install the following:
- Java
- Maven
# Install the Maven extension:
output="$(mvn help:evaluate -Dexpression=maven.home -DforceStdout -q)/lib/ext/maven-build-scanner-jar-with-dependencies.jar"
curl -L https://github.com/intuit/maven-build-scanner/releases/download/v2.0.0/maven-build-scanner-jar-with-dependencies.jar -o $output
# Create your first scan:
mvn install
# Start the server to view your results:
output="$(mvn help:evaluate -Dexpression=maven.home -DforceStdout -q)/lib/ext/maven-build-scanner-jar-with-dependencies.jar"
java -jar $output
This will print out a URL to the report. The report will show:
- A timeline of the build, so you can see how effective concurrency is being used.
- A pie chart showing the Maven plugins that took the longest.
- A module-by-module breakdown of tasks.
- Links to reports on previous builds.
output="$(mvn help:evaluate -Dexpression=maven.home -DforceStdout -q)/lib/ext/maven-build-scanner-jar-with-dependencies.jar"
rm -f $output
Install the following:
- Java
- Maven
- Docker
Clone the github repository and run
mvn install
to build the project and install into your local .m2
diretory.
Create a file .mvn/extensions.xml
in the project you want to analyze:
<?xml version="1.0" encoding="UTF-8"?>
<extensions>
<extension>
<groupId>com.intuit</groupId>
<artifactId>maven-build-scanner</artifactId>
<version>2.0.0-SNAPSHOT</version>
</extension>
</extensions>
# Create your first scan:
mvn install
Use docker to launch the server:
# Create your first scan:
docker-compose up -d
This will print launch the server listening on port `3000. The report will show:
- A timeline of the build, so you can see how effective concurrency is being used.
- A pie chart showing the Maven plugins that took the longest.
- A module-by-module breakdown of tasks.
- Links to reports on previous builds.
- Remove the entry in the
extensions.xml
- Remove the docker container:
docker compose stop && docker compose rm