'Using git commit count and commit hash as version in artifact generated by Maven

I've seen so many (answered) questions about using git commit hash as suffix in the version generated when releasing library. But I can't find any link that describe using commit count in combination of commit hash.

The version format that I'm looking for is <commit count>-<commit hash> for Java library built using Maven.

Is there any existing Maven plugin that can generate that format?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source