Test unresolved dependency analysis in the Gradle plugin

See gh-12784
pull/12960/head
Andy Wilkinson 7 years ago
parent e3e404f9f9
commit 806978b8f1

@ -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();
}
}

@ -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'
}
Loading…
Cancel
Save