Spring Boot's new Gradle plugin

One of the main themes of Spring Boot 2.0 M1 is a range of significant improvements to its Gradle plugin . Many of those improvements have just been merged and are available in the latest Spring Boot snapshots. There's a few weeks until Spring Boot 2.0.0.M1 will be released at the beginning of May and we'd love to hear your early feedback on the new plugin before then.

You can read more about the plugin's capabilities in its reference and API documentation.

Trying the new plugin

The new plugin requires Gradle 3.4 or later. Like the rest of Spring Boot, snapshots are published to https://repo.spring.io/libs-snapshot . The easiest way to use a snapshot is to create a new Gradle project on start.spring.io and select Spring Boot 2.0 snapshots.

Alternatively, your build.gradle should look something like this:

buildscript {
    ext {
        springBootVersion = '2.0.0.BUILD-SNAPSHOT'
    repositories {
        mavenCentral()
        maven { url 'https://repo.spring.io/libs-snapshot' }
    dependencies {
        classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

Building executable jars and wars

The bootRepackage task has been replaced with bootJar and bootWar tasks for building executable jars and wars respectively. Both tasks extend their equivalent standard Gradle jar or war task, giving you access to all of the usual configuration options and behaviour.

Dependency management

Spring Boot's Gradle plugin no longer automatically applies the dependency management plugin. Instead, Spring Boot's plugin now reacts to the dependency management plugin being applied by importing the correct version of the spring-boot-dependencies bom. This gives you more control over how and when dependency management is configured. For most applications applying the dependency management plugin will be sufficient:

apply plugin: 'io.spring.dependency-management'