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.

  • 3
    if you're in a team using a source control system, thought about automizing your build-cycles and using something like Jenkins ..you'd have pretty neat overviews about build-time, error-tracking and whatnot? – definitely undefinable Oct 9 '15 at 13:24
  • @definitely - Thanks - that's a helpful suggestion to monitor the build-time from day-to-day over time, and hopefully in a consistent environment. However, that doesn't take into account how often I am building the project (or sub-modules) in my daily development work. I'd really like to be able to (objectively) say I've spent x mins (or hours!) doing builds each day. (That would provide ammunition for arguing to spend time reducing the build time...) – amaidment Oct 9 '15 at 17:19
  • 1
    In Windows, Performance Monitor should be able to collect statistics on how long particular processes are running. Could you set up some perfmon counters for your build / compile / test executables? – Josh Kelley Oct 12 '15 at 12:10
  • 1
    Seems like a maven plugin should work, although I'm not finding one. – Sign Oct 12 '15 at 15:15
  • 1
    To my understanding IntelliJ will invoke the "mvn" shell script whenever it needs things done (I might easily be wrong on this). This mean that you can hook into this script whatever you need. – Thorbjørn Ravn Andersen Oct 14 '15 at 14:02