mirror of
https://gitee.com/dcren/initializr.git
synced 2025-09-18 17:48:14 +08:00
Remove redundant junit-vintage-engine exclusion with Boot 2.4
Spring Boot 2.4 has switched from providing JUnit 5 in the test starter (JUnit Jupiter and the JUnit Vintage Engine) to only providing JUnit Jupiter. As such, the exclusion of junit-vintage-engine is no longer required for projects that are using Spring Boot 2.4. Closes gh-1095
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2020 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.
|
||||
@@ -49,7 +49,7 @@ public class BuildProjectGenerationConfiguration {
|
||||
@Bean
|
||||
@ConditionalOnPlatformVersion("[2.2.0.M3,2.2.0.M4]")
|
||||
@Deprecated
|
||||
public BuildCustomizer<Build> junitJupiterLegacyTestStarterContributor() {
|
||||
public BuildCustomizer<Build> junit5LegacyTestStarterContributor() {
|
||||
return (build) -> build.dependencies().add("test",
|
||||
Dependency.withCoordinates("org.springframework.boot", "spring-boot-starter-test")
|
||||
.scope(DependencyScope.TEST_COMPILE)
|
||||
@@ -58,14 +58,22 @@ public class BuildProjectGenerationConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnPlatformVersion("2.2.0.M5")
|
||||
public BuildCustomizer<Build> junitJupiterTestStarterContributor() {
|
||||
@ConditionalOnPlatformVersion("[2.2.0.M5,2.4.0-SNAPSHOT)")
|
||||
public BuildCustomizer<Build> junit5TestStarterContributor() {
|
||||
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")));
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnPlatformVersion("2.4.0-M1")
|
||||
public BuildCustomizer<Build> junitJupiterTestStarterContributor() {
|
||||
return (build) -> build.dependencies().add("test",
|
||||
Dependency.withCoordinates("org.springframework.boot", "spring-boot-starter-test")
|
||||
.scope(DependencyScope.TEST_COMPILE));
|
||||
}
|
||||
|
||||
@Bean
|
||||
public DefaultStarterBuildCustomizer defaultStarterContributor(InitializrMetadata metadata) {
|
||||
return new DefaultStarterBuildCustomizer(metadata);
|
||||
|
@@ -181,6 +181,24 @@ class GradleProjectGenerationConfigurationTests {
|
||||
assertThat(project).textFile("build.gradle").doesNotContain("exclude group");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testStarterDoesNotExcludeVintageEngineWith24Snapshot() {
|
||||
MutableProjectDescription description = new MutableProjectDescription();
|
||||
description.setPlatformVersion(Version.parse("2.4.0-SNAPSHOT"));
|
||||
description.setLanguage(new JavaLanguage());
|
||||
ProjectStructure project = this.projectTester.generate(description);
|
||||
assertThat(project).textFile("build.gradle").doesNotContain("exclude group");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testStarterDoesNotExcludeVintageEngineWith24Milestone() {
|
||||
MutableProjectDescription description = new MutableProjectDescription();
|
||||
description.setPlatformVersion(Version.parse("2.4.0-M1"));
|
||||
description.setLanguage(new JavaLanguage());
|
||||
ProjectStructure project = this.projectTester.generate(description);
|
||||
assertThat(project).textFile("build.gradle").doesNotContain("exclude group");
|
||||
}
|
||||
|
||||
static Stream<Arguments> annotationProcessorScopeBuildParameters() {
|
||||
return Stream.of(Arguments.arguments("1.5.17.RELEASE", false), Arguments.arguments("2.0.6.RELEASE", true),
|
||||
Arguments.arguments("2.1.3.RELEASE", true));
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2020 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.
|
||||
@@ -125,4 +125,22 @@ class MavenProjectGenerationConfigurationTests {
|
||||
assertThat(project).textFile("pom.xml").doesNotContain(" <exclusions>");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testStarterDoesNotExcludeVintageEngineWith24Snapshot() {
|
||||
MutableProjectDescription description = new MutableProjectDescription();
|
||||
description.setPlatformVersion(Version.parse("2.4.0-SNAPSHOT"));
|
||||
description.setLanguage(new JavaLanguage());
|
||||
ProjectStructure project = this.projectTester.generate(description);
|
||||
assertThat(project).textFile("pom.xml").doesNotContain(" <exclusions>");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testStarterDoesNotExcludeVintageEngineWith24Milestone() {
|
||||
MutableProjectDescription description = new MutableProjectDescription();
|
||||
description.setPlatformVersion(Version.parse("2.4.0-M1"));
|
||||
description.setLanguage(new JavaLanguage());
|
||||
ProjectStructure project = this.projectTester.generate(description);
|
||||
assertThat(project).textFile("pom.xml").doesNotContain(" <exclusions>");
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user