From c59214792b0ba1fe5c1ef5d4be811556f9e5ccd0 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Thu, 22 Jun 2017 07:46:30 -0700 Subject: [PATCH] Verify that bootJar and bootWar handle duplicates gracefully Closes gh-9573 --- .../AbstractBootArchiveIntegrationTests.java | 6 ++++ ...ests-duplicatesAreHandledGracefully.gradle | 31 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-duplicatesAreHandledGracefully.gradle diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveIntegrationTests.java b/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveIntegrationTests.java index 13d85d4744f..27b8f332782 100644 --- a/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveIntegrationTests.java +++ b/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveIntegrationTests.java @@ -115,4 +115,10 @@ public abstract class AbstractBootArchiveIntegrationTests { } + @Test + public void duplicatesAreHandledGracefully() throws IOException { + assertThat(this.gradleBuild.build(this.taskName).task(":" + this.taskName) + .getOutcome()).isEqualTo(TaskOutcome.SUCCESS); + } + } diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-duplicatesAreHandledGracefully.gradle b/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-duplicatesAreHandledGracefully.gradle new file mode 100644 index 00000000000..4209f27398e --- /dev/null +++ b/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-duplicatesAreHandledGracefully.gradle @@ -0,0 +1,31 @@ +buildscript { + dependencies { + classpath files(pluginClasspath.split(',')) + } +} + +apply plugin: 'java' +apply plugin: 'org.springframework.boot' + +bootJar { + mainClass = 'com.example.CustomMain' + duplicatesStrategy = "exclude" +} + +configurations { + provided +} + +sourceSets.all { + compileClasspath += configurations.provided + runtimeClasspath += configurations.provided +} + +repositories { + maven { url "https://repo.spring.io/libs-snapshot" } +} + +dependencies { + compile "org.apache.commons:commons-lang3:3.6" + provided "org.apache.commons:commons-lang3:3.6" +}