Remove JUnit 4 support

This commit also upgrades the test suite to use a more recent version as
removing support for JUnit4 effectively removes support for those as
well.

Closes gh-1219
This commit is contained in:
Stephane Nicoll
2021-04-13 16:47:11 +02:00
parent 6377ac717f
commit b3c0f16422
39 changed files with 160 additions and 639 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,24 +39,6 @@ import org.springframework.context.annotation.Bean;
@ProjectGenerationConfiguration
public class BuildProjectGenerationConfiguration {
@Bean
@ConditionalOnPlatformVersion("[2.0.0.RELEASE,2.2.0.M3)")
public BuildCustomizer<Build> junit4TestStarterContributor() {
return (build) -> build.dependencies().add("test", "org.springframework.boot", "spring-boot-starter-test",
DependencyScope.TEST_COMPILE);
}
@Bean
@ConditionalOnPlatformVersion("[2.2.0.M3,2.2.0.M4]")
@Deprecated
public BuildCustomizer<Build> junit5LegacyTestStarterContributor() {
return (build) -> build.dependencies().add("test",
Dependency.withCoordinates("org.springframework.boot", "spring-boot-starter-test")
.scope(DependencyScope.TEST_COMPILE)
.exclusions(new Exclusion("org.junit.vintage", "junit-vintage-engine"),
new Exclusion("junit", "junit")));
}
@Bean
@ConditionalOnPlatformVersion("[2.2.0.M5,2.4.0-SNAPSHOT)")
public BuildCustomizer<Build> junit5TestStarterContributor() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,17 +43,6 @@ public class SourceCodeProjectGenerationConfiguration {
}
@Bean
@ConditionalOnPlatformVersion("[2.0.0.RELEASE,2.2.0.M3)")
public TestApplicationTypeCustomizer<TypeDeclaration> junit4SpringBootTestTypeCustomizer() {
return (typeDeclaration) -> {
typeDeclaration.annotate(Annotation.name("org.junit.runner.RunWith", (annotation) -> annotation
.attribute("value", Class.class, "org.springframework.test.context.junit4.SpringRunner")));
typeDeclaration.annotate(Annotation.name("org.springframework.boot.test.context.SpringBootTest"));
};
}
@Bean
@ConditionalOnPlatformVersion("2.2.0.M3")
public TestApplicationTypeCustomizer<TypeDeclaration> junitJupiterSpringBootTestTypeCustomizer() {
return (typeDeclaration) -> typeDeclaration
.annotate(Annotation.name("org.springframework.boot.test.context.SpringBootTest"));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,7 +23,6 @@ import io.spring.initializr.generator.buildsystem.gradle.GradleBuildSystem;
import io.spring.initializr.generator.buildsystem.maven.MavenBuildSystem;
import io.spring.initializr.generator.condition.ConditionalOnBuildSystem;
import io.spring.initializr.generator.condition.ConditionalOnPackaging;
import io.spring.initializr.generator.condition.ConditionalOnPlatformVersion;
import io.spring.initializr.generator.language.Annotation;
import io.spring.initializr.generator.language.Parameter;
import io.spring.initializr.generator.language.groovy.GroovyExpressionStatement;
@@ -61,18 +60,6 @@ class GroovyProjectGenerationDefaultContributorsConfiguration {
}
@Bean
@ConditionalOnPlatformVersion("[2.0.0.RELEASE,2.2.0.M3)")
TestApplicationTypeCustomizer<GroovyTypeDeclaration> junit4TestMethodContributor() {
return (typeDeclaration) -> {
GroovyMethodDeclaration method = GroovyMethodDeclaration.method("contextLoads").modifiers(Modifier.PUBLIC)
.returning("void").body();
method.annotate(Annotation.name("org.junit.Test"));
typeDeclaration.addMethodDeclaration(method);
};
}
@Bean
@ConditionalOnPlatformVersion("2.2.0.M3")
TestApplicationTypeCustomizer<GroovyTypeDeclaration> junitJupiterTestMethodContributor() {
return (typeDeclaration) -> {
GroovyMethodDeclaration method = GroovyMethodDeclaration.method("contextLoads").returning("void").body();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,7 +19,6 @@ package io.spring.initializr.generator.spring.code.java;
import java.lang.reflect.Modifier;
import io.spring.initializr.generator.condition.ConditionalOnPackaging;
import io.spring.initializr.generator.condition.ConditionalOnPlatformVersion;
import io.spring.initializr.generator.language.Annotation;
import io.spring.initializr.generator.language.Parameter;
import io.spring.initializr.generator.language.java.JavaExpressionStatement;
@@ -59,19 +58,6 @@ class JavaProjectGenerationDefaultContributorsConfiguration {
}
@Bean
@ConditionalOnPlatformVersion("[2.0.0.RELEASE,2.2.0.M3)")
TestApplicationTypeCustomizer<JavaTypeDeclaration> junit4TestMethodContributor() {
return (typeDeclaration) -> {
typeDeclaration.modifiers(Modifier.PUBLIC);
JavaMethodDeclaration method = JavaMethodDeclaration.method("contextLoads").modifiers(Modifier.PUBLIC)
.returning("void").body();
method.annotate(Annotation.name("org.junit.Test"));
typeDeclaration.addMethodDeclaration(method);
};
}
@Bean
@ConditionalOnPlatformVersion("2.2.0.M3")
TestApplicationTypeCustomizer<JavaTypeDeclaration> junitJupiterTestMethodContributor() {
return (typeDeclaration) -> {
JavaMethodDeclaration method = JavaMethodDeclaration.method("contextLoads").returning("void").body();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -54,17 +54,6 @@ import org.springframework.context.annotation.Configuration;
class KotlinProjectGenerationDefaultContributorsConfiguration {
@Bean
@ConditionalOnPlatformVersion("[2.0.0.RELEASE,2.2.0.M3)")
TestApplicationTypeCustomizer<KotlinTypeDeclaration> junit4TestMethodContributor() {
return (typeDeclaration) -> {
KotlinFunctionDeclaration function = KotlinFunctionDeclaration.function("contextLoads").body();
function.annotate(Annotation.name("org.junit.Test"));
typeDeclaration.addFunctionDeclaration(function);
};
}
@Bean
@ConditionalOnPlatformVersion("2.2.0.M3")
TestApplicationTypeCustomizer<KotlinTypeDeclaration> junitJupiterTestMethodContributor() {
return (typeDeclaration) -> {
KotlinFunctionDeclaration function = KotlinFunctionDeclaration.function("contextLoads").body();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -114,30 +114,6 @@ class BuildComplianceTests extends AbstractComplianceTests {
new ClassPathResource("project/" + language + "/standard/war-" + getAssertFileName(fileName)));
}
@ParameterizedTest
@MethodSource("parameters")
void previousGenerationJarJava(BuildSystem build, String fileName) {
testPreviousGenerationJar(java, build, fileName);
}
@ParameterizedTest
@MethodSource("parameters")
void previousGenerationJarGroovy(BuildSystem build, String fileName) {
testPreviousGenerationJar(groovy, build, fileName);
}
@ParameterizedTest
@MethodSource("parameters")
void previousGenerationJarKotlin(BuildSystem build, String fileName) {
testPreviousGenerationJar(kotlin, build, fileName);
}
private void testPreviousGenerationJar(Language language, BuildSystem build, String fileName) {
ProjectStructure project = generateProject(language, build, "2.1.0.RELEASE");
assertThat(project).textFile(fileName).hasSameContentAs(
new ClassPathResource("project/" + language + "/previous/" + getAssertFileName(fileName)));
}
@ParameterizedTest
@MethodSource("parameters")
void kotlinJava11(BuildSystem build, String fileName) {
@@ -259,7 +235,7 @@ class BuildComplianceTests extends AbstractComplianceTests {
InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults().addDependencyGroup("test", foo)
.build();
ProjectStructure project = generateProject(java, build, "2.4.1", (description) -> {
description.setPlatformVersion(Version.parse("2.2.0.M1"));
description.setPlatformVersion(Version.parse("2.4.0-M1"));
description.addDependency("foo", MetadataBuildItemMapper.toDependency(foo));
}, metadata);
assertThat(project).textFile(fileName).hasSameContentAs(

View File

@@ -107,19 +107,36 @@ class GradleKtsProjectGenerationConfigurationTests {
@Test
void buildDotGradleDotKtsIsContributedWhenGeneratingGradleKtsProject() {
MutableProjectDescription description = new MutableProjectDescription();
description.setPlatformVersion(Version.parse("2.1.0.RELEASE"));
description.setPlatformVersion(Version.parse("2.4.0"));
description.setLanguage(new JavaLanguage("11"));
description.addDependency("acme",
Dependency.withCoordinates("com.example", "acme").scope(DependencyScope.COMPILE));
ProjectStructure project = this.projectTester.generate(description);
assertThat(project).textFile("build.gradle.kts").containsExactly("plugins {",
" id(\"org.springframework.boot\") version \"2.1.0.RELEASE\"",
" id(\"io.spring.dependency-management\") version \"1.0.6.RELEASE\"", " java", "}", "",
"group = \"com.example\"", "version = \"0.0.1-SNAPSHOT\"",
"java.sourceCompatibility = JavaVersion.VERSION_11", "", "repositories {", " mavenCentral()", "}",
"", "dependencies {", " implementation(\"org.springframework.boot:spring-boot-starter\")",
assertThat(project).textFile("build.gradle.kts")
.containsExactly(// @formatter:off
"plugins {",
" id(\"org.springframework.boot\") version \"2.4.0\"",
" id(\"io.spring.dependency-management\") version \"1.0.6.RELEASE\"",
" java",
"}",
"",
"group = \"com.example\"",
"version = \"0.0.1-SNAPSHOT\"",
"java.sourceCompatibility = JavaVersion.VERSION_11",
"",
"repositories {",
" mavenCentral()",
"}",
"",
"dependencies {",
" implementation(\"org.springframework.boot:spring-boot-starter\")",
" implementation(\"com.example:acme\")",
" testImplementation(\"org.springframework.boot:spring-boot-starter-test\")", "}");
" testImplementation(\"org.springframework.boot:spring-boot-starter-test\")",
"}",
"",
"tasks.withType<Test> {",
" useJUnitPlatform()",
"}"); // @formatter:on
}
@Test
@@ -164,14 +181,4 @@ class GradleKtsProjectGenerationConfigurationTests {
" useJUnitPlatform()", "}");
}
@Test
void junitPlatformIsNotConfiguredWithIncompatibleVersion() {
MutableProjectDescription description = new MutableProjectDescription();
description.setPlatformVersion(Version.parse("2.1.4.RELEASE"));
description.setLanguage(new JavaLanguage());
ProjectStructure project = this.projectTester.generate(description);
assertThat(project).textFile("build.gradle.kts").lines().doesNotContainSequence("tasks.withType<Test> {",
" useJUnitPlatform()", "}");
}
}

View File

@@ -104,19 +104,36 @@ class GradleProjectGenerationConfigurationTests {
@Test
void buildDotGradleIsContributedWhenGeneratingGradleProject() {
MutableProjectDescription description = new MutableProjectDescription();
description.setPlatformVersion(Version.parse("2.1.0.RELEASE"));
description.setPlatformVersion(Version.parse("2.4.0"));
description.setLanguage(new JavaLanguage("11"));
description.addDependency("acme",
Dependency.withCoordinates("com.example", "acme").scope(DependencyScope.COMPILE));
ProjectStructure project = this.projectTester.generate(description);
assertThat(project).textFile("build.gradle").containsExactly("plugins {",
" id 'org.springframework.boot' version '2.1.0.RELEASE'",
" id 'io.spring.dependency-management' version '1.0.6.RELEASE'", " id 'java'", "}", "",
"group = 'com.example'", "version = '0.0.1-SNAPSHOT'", "sourceCompatibility = '11'", "",
"repositories {", " mavenCentral()", "}", "", "dependencies {",
assertThat(project).textFile("build.gradle").containsExactly(
// @formatter:off
"plugins {",
" id 'org.springframework.boot' version '2.4.0'",
" id 'io.spring.dependency-management' version '1.0.6.RELEASE'",
" id 'java'",
"}",
"",
"group = 'com.example'",
"version = '0.0.1-SNAPSHOT'",
"sourceCompatibility = '11'",
"",
"repositories {",
" mavenCentral()",
"}",
"",
"dependencies {",
" implementation 'org.springframework.boot:spring-boot-starter'",
" implementation 'com.example:acme'",
" testImplementation 'org.springframework.boot:spring-boot-starter-test'", "}");
" testImplementation 'org.springframework.boot:spring-boot-starter-test'",
"}",
"",
"test {",
" useJUnitPlatform()",
"}"); // @formatter:on
}
@Test
@@ -138,33 +155,10 @@ class GradleProjectGenerationConfigurationTests {
assertThat(project).textFile("build.gradle").lines().containsSequence("test {", " useJUnitPlatform()", "}");
}
@Test
void junitPlatformIsNotConfiguredWithIncompatibleVersion() {
MutableProjectDescription description = new MutableProjectDescription();
description.setPlatformVersion(Version.parse("2.1.4.RELEASE"));
description.setLanguage(new JavaLanguage());
ProjectStructure project = this.projectTester.generate(description);
assertThat(project).textFile("build.gradle").lines().doesNotContainSequence("test {", " useJUnitPlatform()",
"}");
}
@Test
@Deprecated
void testStarterExcludesVintageEngineAndJUnitWithAppropriateVersion() {
MutableProjectDescription description = new MutableProjectDescription();
description.setPlatformVersion(Version.parse("2.2.0.M4"));
description.setLanguage(new JavaLanguage());
ProjectStructure project = this.projectTester.generate(description);
assertThat(project).textFile("build.gradle").lines().containsSequence(
" testImplementation('org.springframework.boot:spring-boot-starter-test') {",
" exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'",
" exclude group: 'junit', module: 'junit'", " }");
}
@Test
void testStarterExcludesVintageEngineWithCompatibleVersion() {
MutableProjectDescription description = new MutableProjectDescription();
description.setPlatformVersion(Version.parse("2.2.0.M5"));
description.setPlatformVersion(Version.parse("2.2.4.RELEASE"));
description.setLanguage(new JavaLanguage());
ProjectStructure project = this.projectTester.generate(description);
assertThat(project).textFile("build.gradle").lines().containsSequence(
@@ -172,15 +166,6 @@ class GradleProjectGenerationConfigurationTests {
" exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'", " }");
}
@Test
void testStarterDoesNotExcludesVintageEngineAndJUnitWithIncompatibleVersion() {
MutableProjectDescription description = new MutableProjectDescription();
description.setPlatformVersion(Version.parse("2.1.6.RELEASE"));
description.setLanguage(new JavaLanguage());
ProjectStructure project = this.projectTester.generate(description);
assertThat(project).textFile("build.gradle").doesNotContain("exclude group");
}
@Test
void testStarterDoesNotExcludeVintageEngineWith24Snapshot() {
MutableProjectDescription description = new MutableProjectDescription();
@@ -199,19 +184,13 @@ class GradleProjectGenerationConfigurationTests {
assertThat(project).textFile("build.gradle").doesNotContain("exclude group");
}
static Stream<Arguments> annotationProcessorScopeBuildParameters() {
return Stream.of(Arguments.arguments("2.0.6.RELEASE", true), Arguments.arguments("2.1.3.RELEASE", true));
}
@ParameterizedTest(name = "Spring Boot {0}")
@MethodSource("annotationProcessorScopeBuildParameters")
void gradleAnnotationProcessorScopeCustomizerIsContributedIfNecessary(String platformVersion,
boolean contributorExpected) {
@Test
void gradleAnnotationProcessorScopeCustomizerIsContributed() {
MutableProjectDescription description = new MutableProjectDescription();
description.setPlatformVersion(Version.parse(platformVersion));
description.setPlatformVersion(Version.parse("2.4.0"));
description.setLanguage(new JavaLanguage());
this.projectTester.configure(description, (context) -> assertThat(context)
.getBeans(GradleAnnotationProcessorScopeBuildCustomizer.class).hasSize((contributorExpected) ? 1 : 0));
this.projectTester.configure(description,
(context) -> assertThat(context).hasSingleBean(GradleAnnotationProcessorScopeBuildCustomizer.class));
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -89,25 +89,10 @@ class MavenProjectGenerationConfigurationTests {
assertThat(project).textFile("pom.xml").containsOnlyOnce(" <packaging>war</packaging>");
}
@Test
@Deprecated
void testStarterExcludesVintageEngineAndJUnitWithAppropriateVersion() {
MutableProjectDescription description = new MutableProjectDescription();
description.setPlatformVersion(Version.parse("2.2.0.M4"));
description.setLanguage(new JavaLanguage());
ProjectStructure project = this.projectTester.generate(description);
assertThat(project).textFile("pom.xml").lines().containsSequence(" <exclusions>",
" <exclusion>", " <groupId>org.junit.vintage</groupId>",
" <artifactId>junit-vintage-engine</artifactId>", " </exclusion>",
" <exclusion>", " <groupId>junit</groupId>",
" <artifactId>junit</artifactId>", " </exclusion>",
" </exclusions>");
}
@Test
void testStarterExcludesVintageEngineWithCompatibleVersion() {
MutableProjectDescription description = new MutableProjectDescription();
description.setPlatformVersion(Version.parse("2.2.0.M5"));
description.setPlatformVersion(Version.parse("2.2.4.RELEASE"));
description.setLanguage(new JavaLanguage());
ProjectStructure project = this.projectTester.generate(description);
assertThat(project).textFile("pom.xml").lines().containsSequence(" <exclusions>",

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -56,17 +56,6 @@ class SourceCodeProjectGenerationConfigurationTests {
.isEqualTo("org.springframework.boot.autoconfigure.SpringBootApplication"));
}
@Test
void addsACustomizerThatAppliesTestAnnotationsOnTestClassWithJunit4() {
TypeDeclaration declaration = generateTestTypeDeclaration("2.1.0.RELEASE");
assertThat(declaration.getAnnotations()).hasSize(2);
assertThat(declaration.getAnnotations().get(0).getName()).isEqualTo("org.junit.runner.RunWith");
assertThat(declaration.getAnnotations().get(0).getAttributes().get(0).getValues())
.containsOnly("org.springframework.test.context.junit4.SpringRunner");
assertThat(declaration.getAnnotations().get(1).getName())
.isEqualTo("org.springframework.boot.test.context.SpringBootTest");
}
@Test
void addsACustomizerThatAppliesTestAnnotationsOnTestClassWithJunit5() {
TypeDeclaration declaration = generateTestTypeDeclaration("2.2.0.RELEASE");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -61,19 +61,6 @@ class GroovyProjectGenerationConfigurationTests {
assertThat(project).containsFiles("src/main/groovy/com/example/demo/DemoApplication.groovy");
}
@Test
void testClassIsContributedWithJUnit4() {
MutableProjectDescription description = new MutableProjectDescription();
description.setPlatformVersion(Version.parse("2.1.4.RELEASE"));
ProjectStructure project = this.projectTester.generate(description);
assertThat(project).textFile("src/test/groovy/com/example/demo/DemoApplicationTests.groovy").containsExactly(
"package com.example.demo", "", "import org.junit.Test", "import org.junit.runner.RunWith",
"import org.springframework.boot.test.context.SpringBootTest",
"import org.springframework.test.context.junit4.SpringRunner", "", "@RunWith(SpringRunner)",
"@SpringBootTest", "class DemoApplicationTests {", "", " @Test", " void contextLoads() {",
" }", "", "}");
}
@Test
void testClassIsContributedWithJUnit5() {
MutableProjectDescription description = new MutableProjectDescription();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -62,19 +62,6 @@ class JavaProjectGenerationConfigurationTests {
assertThat(project).containsFiles("src/main/java/com/example/demo/DemoApplication.java");
}
@Test
void testClassIsContributedWithJUnit4() {
MutableProjectDescription description = new MutableProjectDescription();
description.setPlatformVersion(Version.parse("2.1.4.RELEASE"));
ProjectStructure project = this.projectTester.generate(description);
assertThat(project).textFile("src/test/java/com/example/demo/DemoApplicationTests.java").containsExactly(
"package com.example.demo;", "", "import org.junit.Test;", "import org.junit.runner.RunWith;",
"import org.springframework.boot.test.context.SpringBootTest;",
"import org.springframework.test.context.junit4.SpringRunner;", "", "@RunWith(SpringRunner.class)",
"@SpringBootTest", "public class DemoApplicationTests {", "", " @Test",
" public void contextLoads() {", " }", "", "}");
}
@Test
void testClassIsContributedWithJUnit5() {
MutableProjectDescription description = new MutableProjectDescription();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -86,19 +86,6 @@ class KotlinProjectGenerationConfigurationTests {
assertThat(project).containsFiles("src/main/kotlin/com/example/demo/DemoApplication.kt");
}
@Test
void testClassIsContributedWithJunit4() {
MutableProjectDescription description = new MutableProjectDescription();
description.setPlatformVersion(Version.parse("2.1.4.RELEASE"));
ProjectStructure project = this.projectTester.generate(description);
assertThat(project).textFile("src/test/kotlin/com/example/demo/DemoApplicationTests.kt").containsExactly(
"package com.example.demo", "", "import org.junit.Test", "import org.junit.runner.RunWith",
"import org.springframework.boot.test.context.SpringBootTest",
"import org.springframework.test.context.junit4.SpringRunner", "", "@RunWith(SpringRunner::class)",
"@SpringBootTest", "class DemoApplicationTests {", "", " @Test", " fun contextLoads() {", " }",
"", "}");
}
@Test
void testClassIsContributedWithJunit5() {
MutableProjectDescription description = new MutableProjectDescription();

View File

@@ -1,5 +1,5 @@
plugins {
id 'org.springframework.boot' version '2.2.0.M1'
id 'org.springframework.boot' version '2.4.0-M1'
id 'io.spring.dependency-management' version '1.0.6.RELEASE'
id 'java'
}
@@ -17,3 +17,7 @@ dependencies {
implementation 'org.acme:foo'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
test {
useJUnitPlatform()
}

View File

@@ -1,5 +1,5 @@
plugins {
id("org.springframework.boot") version "2.2.0.M1"
id("org.springframework.boot") version "2.4.0-M1"
id("io.spring.dependency-management") version "1.0.6.RELEASE"
java
}
@@ -17,3 +17,7 @@ dependencies {
implementation("org.acme:foo")
testImplementation("org.springframework.boot:spring-boot-starter-test")
}
tasks.withType<Test> {
useJUnitPlatform()
}

View File

@@ -1,19 +0,0 @@
plugins {
id 'org.springframework.boot' version '2.1.0.RELEASE'
id 'io.spring.dependency-management' version '1.0.6.RELEASE'
id 'groovy'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter'
implementation 'org.codehaus.groovy:groovy'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

View File

@@ -1,19 +0,0 @@
plugins {
id("org.springframework.boot") version "2.1.0.RELEASE"
id("io.spring.dependency-management") version "1.0.6.RELEASE"
groovy
}
group = "com.example"
version = "0.0.1-SNAPSHOT"
java.sourceCompatibility = JavaVersion.VERSION_1_8
repositories {
mavenCentral()
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter")
implementation("org.codehaus.groovy:groovy")
testImplementation("org.springframework.boot:spring-boot-starter-test")
}

View File

@@ -1,66 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>1.11.0</version>
<executions>
<execution>
<goals>
<goal>addSources</goal>
<goal>addTestSources</goal>
<goal>generateStubs</goal>
<goal>compile</goal>
<goal>generateTestStubs</goal>
<goal>compileTests</goal>
<goal>removeStubs</goal>
<goal>removeTestStubs</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -1,18 +0,0 @@
plugins {
id 'org.springframework.boot' version '2.1.0.RELEASE'
id 'io.spring.dependency-management' version '1.0.6.RELEASE'
id 'java'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

View File

@@ -1,18 +0,0 @@
plugins {
id("org.springframework.boot") version "2.1.0.RELEASE"
id("io.spring.dependency-management") version "1.0.6.RELEASE"
java
}
group = "com.example"
version = "0.0.1-SNAPSHOT"
java.sourceCompatibility = JavaVersion.VERSION_1_8
repositories {
mavenCentral()
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter")
testImplementation("org.springframework.boot:spring-boot-starter-test")
}

View File

@@ -1,43 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@@ -1,30 +0,0 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id 'org.springframework.boot' version '2.1.0.RELEASE'
id 'io.spring.dependency-management' version '1.0.6.RELEASE'
id 'org.jetbrains.kotlin.jvm' version '1.1.1'
id 'org.jetbrains.kotlin.plugin.spring' version '1.1.1'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter'
implementation 'org.jetbrains.kotlin:kotlin-reflect'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
tasks.withType(KotlinCompile) {
kotlinOptions {
freeCompilerArgs = ['-Xjsr305=strict']
jvmTarget = '1.8'
}
}

View File

@@ -1,30 +0,0 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("org.springframework.boot") version "2.1.0.RELEASE"
id("io.spring.dependency-management") version "1.0.6.RELEASE"
kotlin("jvm") version "1.1.1"
kotlin("plugin.spring") version "1.1.1"
}
group = "com.example"
version = "0.0.1-SNAPSHOT"
java.sourceCompatibility = JavaVersion.VERSION_1_8
repositories {
mavenCentral()
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
testImplementation("org.springframework.boot:spring-boot-starter-test")
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "1.8"
}
}

View File

@@ -1,73 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
<kotlin.version>1.1.1</kotlin.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-reflect</artifactId>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
<testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<configuration>
<args>
<arg>-Xjsr305=strict</arg>
</args>
<compilerPlugins>
<plugin>spring</plugin>
</compilerPlugins>
</configuration>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-allopen</artifactId>
<version>${kotlin.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.0.M1</version>
<version>2.4.0-M1</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>