How to add jenkins git branch build_number inside jar manifest

Jenkins exposes these to Gradle in the form of environment variables. Therefore you can access them in your Gradle build script as System.env.BUILD_NUMBER.