mirror of
https://gitee.com/dcren/initializr.git
synced 2025-04-29 19:56:47 +08:00
Apply the dependency management plugin in Boot 2.0 Gradle projects
Closes gh-398
This commit is contained in:
parent
c8a6af0b2f
commit
c6f502cb9c
@ -56,6 +56,7 @@ import org.springframework.util.StreamUtils;
|
|||||||
* @author Dave Syer
|
* @author Dave Syer
|
||||||
* @author Stephane Nicoll
|
* @author Stephane Nicoll
|
||||||
* @author Sebastien Deleuze
|
* @author Sebastien Deleuze
|
||||||
|
* @author Andy Wilkinson
|
||||||
*/
|
*/
|
||||||
public class ProjectGenerator {
|
public class ProjectGenerator {
|
||||||
|
|
||||||
@ -73,6 +74,8 @@ public class ProjectGenerator {
|
|||||||
|
|
||||||
private static final Version VERSION_1_5_0_M1 = Version.parse("1.5.0.M1");
|
private static final Version VERSION_1_5_0_M1 = Version.parse("1.5.0.M1");
|
||||||
|
|
||||||
|
private static final Version VERSION_2_0_0_BUILD_SNAPSHOT = Version.parse("2.0.0.BUILD-SNAPSHOT");
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ApplicationEventPublisher eventPublisher;
|
private ApplicationEventPublisher eventPublisher;
|
||||||
|
|
||||||
@ -417,6 +420,9 @@ public class ProjectGenerator {
|
|||||||
model.put("bootOneThreeAvailable", VERSION_1_3_0_M1
|
model.put("bootOneThreeAvailable", VERSION_1_3_0_M1
|
||||||
.compareTo(Version.safeParse(request.getBootVersion())) <= 0);
|
.compareTo(Version.safeParse(request.getBootVersion())) <= 0);
|
||||||
|
|
||||||
|
model.put("bootTwoZeroAvailable", VERSION_2_0_0_BUILD_SNAPSHOT
|
||||||
|
.compareTo(Version.safeParse(request.getBootVersion())) <= 0);
|
||||||
|
|
||||||
// Gradle plugin has changed again as from 1.4.2
|
// Gradle plugin has changed again as from 1.4.2
|
||||||
model.put("springBootPluginName",
|
model.put("springBootPluginName",
|
||||||
(VERSION_1_4_2_M1
|
(VERSION_1_4_2_M1
|
||||||
|
@ -37,6 +37,9 @@ apply plugin: '{{springBootPluginName}}'
|
|||||||
{{^bootOneThreeAvailable}}
|
{{^bootOneThreeAvailable}}
|
||||||
apply plugin: 'io.spring.dependency-management'
|
apply plugin: 'io.spring.dependency-management'
|
||||||
{{/bootOneThreeAvailable}}
|
{{/bootOneThreeAvailable}}
|
||||||
|
{{#bootTwoZeroAvailable}}
|
||||||
|
apply plugin: 'io.spring.dependency-management'
|
||||||
|
{{/bootTwoZeroAvailable}}
|
||||||
{{#war}}
|
{{#war}}
|
||||||
apply plugin: 'war'
|
apply plugin: 'war'
|
||||||
{{/war}}
|
{{/war}}
|
||||||
|
@ -41,6 +41,7 @@ import static org.junit.Assert.fail;
|
|||||||
* Tests for {@link ProjectGenerator}
|
* Tests for {@link ProjectGenerator}
|
||||||
*
|
*
|
||||||
* @author Stephane Nicoll
|
* @author Stephane Nicoll
|
||||||
|
* @author Andy Wilkinson
|
||||||
*/
|
*/
|
||||||
public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||||
|
|
||||||
@ -510,6 +511,17 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
|||||||
.doesNotContain("apply plugin: 'spring-boot'");
|
.doesNotContain("apply plugin: 'spring-boot'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void gradleBuildAsFromSpringBoot20() {
|
||||||
|
ProjectRequest request = createProjectRequest("web");
|
||||||
|
request.setBootVersion("2.0.0.BUILD-SNAPSHOT");
|
||||||
|
generateGradleBuild(request)
|
||||||
|
.contains("springBootVersion = '2.0.0.BUILD-SNAPSHOT'")
|
||||||
|
.contains("apply plugin: 'org.springframework.boot'")
|
||||||
|
.doesNotContain("apply plugin: 'spring-boot'")
|
||||||
|
.contains("apply plugin: 'io.spring.dependency-management'");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void mavenBom() {
|
public void mavenBom() {
|
||||||
Dependency foo = Dependency.withId("foo", "org.acme", "foo");
|
Dependency foo = Dependency.withId("foo", "org.acme", "foo");
|
||||||
|
Loading…
Reference in New Issue
Block a user