16

We have a huge project with many submodules. A full build takes currently over 30mins.

I wonder how this time distributes over different plugins/goals, e.g. tests, static analysis (findbugs, pmd, checkstyle, etc ...)

Would it be possible to time the build to see where (in both dimensions: modules and goals) most time is spent?

artbristol
  • 32,010
  • 5
  • 70
  • 103
Bastl
  • 1,431
  • 3
  • 14
  • 15
  • Related question http://stackoverflow.com/questions/5120470/how-to-time-the-different-stages-of-maven-execution – artbristol Jun 10 '11 at 12:09

3 Answers3

12

The maven-buildtime-extension is a maven plugin that can be used to see the times of each goal:

https://github.com/timgifford/maven-buildtime-extension

Tim Andersen
  • 344
  • 3
  • 7
4

If you run the build in a CI server like TeamCity or Jenkins (formerly Hudson), it will give you timestamps for every step in the build process and you should be able to use these values to determine which goals/projects are taking the most time.

I don't think there is any way built in to maven to do this. In fact, in the related question artbristol posted, there is a link to a Maven feature request for this functionality. Unfortunately, this issue is unresolved and I don't know if it will ever be added.

The other potential solution is to write your own plugin which would provide this build metadata for you.

Ralph
  • 118,862
  • 56
  • 287
  • 383
Jesse Webb
  • 43,135
  • 27
  • 106
  • 143
0

I don't think there is a way to determine the timing of particular goals. What you can do is run the particular goals separately to see how long they take. So instead of doing a "mvn install" which runs all of your tests, checkstyle, etc.. just do "mvn checkstyle:checkstyle" to see how long that takes for a particular module.

Having everything done every time is nice when its done by an automated server (continuum/jenkins/hudson) but when you are building locally, sometimes its better to be able to just compile. Some of the things you can do are have the static analysis goals ONLY run when you pass in a certain parameter or profile. Another option is to only have them ran when maven.test.skip=false.

If you are using a continuous build, try having the static analysis only done every 4 hours, or daily.

DaShaun
  • 3,722
  • 2
  • 27
  • 29