title: How to generate application version using Spring Boot, Gradle, Semantic Versioning and Jenkins
body: <p>I have a Spring Boot web application with actuator enabled. When I open <code>&lt;app_url&gt;/info</code>, I see below</p>
  
  <pre><code>{
      "git": {
          "commit": {
              "time": "2016-08-31T17:53:28.000+0000",
              "id": "0a52a2f"
          },
          "branch": "master"
      },
      "build": {
          "version": "unspecified",
          "artifact": "my-app",
          "name": "my-app",
          "group": "",
          "time": "2016-09-02T21:09:42.000+0000"
      }
  }
  </code></pre>
  
  <p>I'm not sure how to generate a version number here. I want to use Semantic Versioning <code>MAJOR.MINOR.PATCH+timestamp+Build_Number</code></p>
  
  <p>What is the general consensus w.r.t storing build information of a package ? I don't want to store it in <code>application.yml</code> because it is managed by Puppet and is external to the application war. I would like it to be generated by Jenkins into some file and Spring Boot can pick it up from that file. Should I let Jenkins write into <code>build-info.properties</code> that is generated by <code>spring-boot-gradle-plugin</code> <code>buildInfo</code> ? or should the version be generated by Gradle itself when it generates the file? How does Gradle know <code>MAJOR.MINOR.PATCH</code> details ? I'm running out of ideas on how to integrate all these together.  </p>