diff --git a/initializr-generator/src/main/groovy/io/spring/initializr/generator/ProjectGenerator.groovy b/initializr-generator/src/main/groovy/io/spring/initializr/generator/ProjectGenerator.groovy index 2daa427c..930a9594 100644 --- a/initializr-generator/src/main/groovy/io/spring/initializr/generator/ProjectGenerator.groovy +++ b/initializr-generator/src/main/groovy/io/spring/initializr/generator/ProjectGenerator.groovy @@ -50,6 +50,8 @@ class ProjectGenerator { private static final VERSION_1_4_0_M3 = Version.parse('1.4.0.M3') + private static final VERSION_1_4_2_M1 = Version.parse('1.4.2.M1') + @Autowired ApplicationEventPublisher eventPublisher @@ -278,6 +280,10 @@ class ProjectGenerator { model['bootOneThreeAvailable'] = VERSION_1_3_0_M1 .compareTo(Version.safeParse(request.bootVersion)) <= 0 + // Gradle plugin has changed again as from 1.4.2 + model['springBootPluginName'] = (VERSION_1_4_2_M1.compareTo( + Version.safeParse(request.bootVersion)) <= 0 ? 'org.springframework.boot' : 'spring-boot') + // New testing stuff model['newTestInfrastructure'] = isNewTestInfrastructureAvailable(request) diff --git a/initializr-generator/src/main/resources/templates/starter-build.gradle b/initializr-generator/src/main/resources/templates/starter-build.gradle index 00310e76..523454e5 100644 --- a/initializr-generator/src/main/resources/templates/starter-build.gradle +++ b/initializr-generator/src/main/resources/templates/starter-build.gradle @@ -17,7 +17,7 @@ buildscript { apply plugin: '${language}'<% if (packaging=='war') { %> apply plugin: 'eclipse-wtp'<% } else { %> apply plugin: 'eclipse'<% } %> -apply plugin: 'spring-boot'<% if (!bootOneThreeAvailable) { %> +apply plugin: '${springBootPluginName}'<% if (!bootOneThreeAvailable) { %> apply plugin: 'io.spring.dependency-management'<% } %><% if (packaging=='war') { %> apply plugin: 'war' <% } %> diff --git a/initializr-generator/src/test/groovy/io/spring/initializr/generator/ProjectGeneratorTests.groovy b/initializr-generator/src/test/groovy/io/spring/initializr/generator/ProjectGeneratorTests.groovy index a2e63338..26fcee4d 100644 --- a/initializr-generator/src/test/groovy/io/spring/initializr/generator/ProjectGeneratorTests.groovy +++ b/initializr-generator/src/test/groovy/io/spring/initializr/generator/ProjectGeneratorTests.groovy @@ -460,6 +460,16 @@ class ProjectGeneratorTests extends AbstractProjectGeneratorTests { .doesNotContain("apply plugin: 'io.spring.dependency-management'") } + @Test + void gradleBuildAsFromSpringBoot142() { + def request = createProjectRequest('web') + request.bootVersion = '1.4.2.BUILD-SNAPSHOT' + generateGradleBuild(request) + .contains("springBootVersion = '1.4.2.BUILD-SNAPSHOT'") + .contains("apply plugin: 'org.springframework.boot'") + .doesNotContain("apply plugin: 'spring-boot'") + } + @Test void mavenBom() { def foo = new Dependency(id: 'foo', groupId: 'org.acme', artifactId: 'foo', bom: 'foo-bom')