Reputation: 325
I want to collect the build metrics for a maven build (metrics like total time taken for the build, status of build SUCCESS or FAILURE, test results etc.,) and store it for analysis. All these information are available in the log but i need to collect it at the end of the build and call a service with the data.
This feature should be available where ever maven build is done. so it should be associated with the lifecycle. But i am not sure whether maven has any hooks to tap to get this kind of information.
- Kamal
Upvotes: 3
Views: 1243
Reputation: 2297
@Kamal's answer requires you to modify your local Maven installation which is not a portable solution.
Here is a maven plugin which collects execution times of each plugin and saves it as an HTML report. The plugin utilizes Maven's core extensions feature which was introduced in 2015, so that you don't have to modify your Maven installation.
https://github.com/jcgay/maven-profiler
Upvotes: 0
Reputation: 325
I found a way to profile the maven build in developer machines.
For Maven 3 and above, it exposes the events through EventSpy API. An example profiler is available at https://github.com/tesla/tesla-profiler . so we implemented our own profiler and it logs the data to the central server.
For Maven 2.x, there is no easy way. I modified Maven to expose the events and wrote listener to track the data
Upvotes: 2
Reputation: 15675
You might want to look into Continuous Integration, which will build your project everytime you commit to the repository. I personally like Jenkins, where you can install the Global Build Stats Plugin which I think will cover what you want to do
Upvotes: 2