git,maven,buildnumber-maven-plugin,rpm-maven-plugin
Thanks to @musiKk 's suggestion, I used git-commit-id-plugin. I had several problems at first because I didn't configure it properly. Though the plugin is not mature enough, it's getting the job done.