diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/plugin/SpringBootPluginIntegrationTests.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/plugin/SpringBootPluginIntegrationTests.java index 26b6cab904..0dd6d0ff16 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/plugin/SpringBootPluginIntegrationTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/plugin/SpringBootPluginIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -16,6 +16,9 @@ package org.springframework.boot.gradle.plugin; +import java.io.File; +import java.io.IOException; + import org.gradle.testkit.runner.BuildResult; import org.junit.Rule; import org.junit.Test; @@ -51,4 +54,22 @@ public class SpringBootPluginIntegrationTests { this.gradleBuild.gradleVersion("4.0").build(); } + @Test + public void unresolvedDependenciesAreAnalyzedWhenDependencyResolutionFails() + throws IOException { + createMinimalMainSource(); + BuildResult result = this.gradleBuild.buildAndFail("compileJava"); + assertThat(result.getOutput()).contains( + "During the build, one or more dependencies that were declared without a" + + " version failed to resolve:") + .contains(" org.springframework.boot:spring-boot-starter:"); + } + + private void createMinimalMainSource() throws IOException { + File examplePackage = new File(this.gradleBuild.getProjectDir(), + "src/main/java/com/example"); + examplePackage.mkdirs(); + new File(examplePackage, "Application.java").createNewFile(); + } + } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/plugin/SpringBootPluginIntegrationTests-unresolvedDependenciesAreAnalyzedWhenDependencyResolutionFails.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/plugin/SpringBootPluginIntegrationTests-unresolvedDependenciesAreAnalyzedWhenDependencyResolutionFails.gradle new file mode 100644 index 0000000000..32ec8c58b1 --- /dev/null +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/plugin/SpringBootPluginIntegrationTests-unresolvedDependenciesAreAnalyzedWhenDependencyResolutionFails.gradle @@ -0,0 +1,16 @@ +buildscript { + dependencies { + classpath files(pluginClasspath.split(',')) + } +} + +apply plugin: 'org.springframework.boot' +apply plugin: 'java' + +repositories { + flatDir { dirs 'libs' } +} + +dependencies { + compile 'org.springframework.boot:spring-boot-starter' +}