80.1 Generate build information

Both the Maven and Gradle plugin allow to generate build information containing the coordinates, name and version of the project. The plugin can also be configured to add additional properties through configuration. When such file is present, Spring Boot auto-configures a BuildProperties bean.

To generate build information with Maven, add an execution for the build-info goal:

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <version>1.4.1.BUILD-SNAPSHOT</version>
            <executions>
                <execution>
                    <goals>
                        <goal>build-info</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
[Tip] Tip
Check the Spring Boot Maven Plugin documentation for more details.

And to do the same with Gradle:

springBoot  {
    buildInfo()
}

Additional properties can be added using the DSL:

springBoot  {
    buildInfo {
        additionalProperties = [
            'foo': 'bar'
        ]
    }
}

results matching ""

    No results matching ""