amaidment
amaidment

Reputation: 7268

How to monitor & record build (compile/test) time?

I work on a large-ish Java project. We are using maven as our build tool, and I use Intellij (14) as my IDE.

Currently, if I build the whole project (c. 15 modules) it takes about 3 minutes. Due to the way that we use our code (even in development), I end up doing a full build quite often. On the basis that "what gets measured gets managed", I'd like to be able to monitor/record:

  1. How many times an hour/day a build has been run?
  2. How much time has been spent running builds?
  3. If it were possible, to break this down by maven task - i.e. clean/compile/test/other plugins etc.

One approach might be to have the maven output dumped to files, and then have a process to read these/calculate the statistics I want. How should I approach this?

Just to be clear, I'm not asking for comments/advice on how to reduce our build-cycle runtime. We've already done a fair bit of work on this, and are continuing to work on it - indeed, I'm really looking for a way to monitor our effective progress on this.

Upvotes: 7

Views: 1556

Answers (1)

A_Di-Matteo
A_Di-Matteo

Reputation: 27812

This Maven Profile project could help you out.

Simply installing (copying) its latest version jar on your ${M2_HOME}/lib/ext and then executing the build as following

mvn clean install -Dmaven.profile

Would provide you the following sample output

    com.sample:test:0.0.1-SNAPSHOT

  clean 175ms
    org.apache.maven.plugins:maven-clean-plugin:2.5 (default-clean) 175ms

  process-resources 336ms
    org.apache.maven.plugins:maven-resources-plugin:2.6 (default-resources) 335ms

  compile 1s 2ms
    org.apache.maven.plugins:maven-compiler-plugin:2.5.1 (default-compile) 1s 2ms

  process-test-resources 9ms
    org.apache.maven.plugins:maven-resources-plugin:2.6 (default-testResources) 9ms

  test-compile 59ms
    org.apache.maven.plugins:maven-compiler-plugin:2.5.1 (default-testCompile) 59ms

  test 1s 83ms
    org.apache.maven.plugins:maven-surefire-plugin:2.12.4 (default-test) 1s 83ms

  package 352ms
    org.apache.maven.plugins:maven-jar-plugin:2.4 (default-jar) 352ms

You would then need to have a further layer (script?) for data accumulation in order to get cross-builds statistics though. However, it already answers to your third question and it is probably a good start.

Upvotes: 2

Related Questions