How to generate application version using Spring Boot, Gradle, Semantic Versioning and Jenkins

I have a Spring Boot web application with the drive turned on. When I open <app_url>/info, I see below

{
    "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"
    }
}

I am not sure how to create the version number here. I want to use Semantic VersioningMAJOR.MINOR.PATCH+timestamp+Build_Number

w.r.t ? application.yml, Puppet . , Jenkins Spring Boot . build-info.properties, spring-boot-gradle-plugin buildInfo? Gradle ? Gradle MAJOR.MINOR.PATCH ? , .

+4
1

, (, ).

springBoot  {
    buildInfo {
        additionalProperties = [
            "version" : System.properties["version"] != null ? System.properties["version"] : "unspecified"
        ]
    }
}

./gradlew clean build -Dversion=${MAJOR}.${MINOR}.${PATCH}

build-info.properties

build.version=1.0.1
0

Source: https://habr.com/ru/post/1653494/


All Articles