Exclude Devtools by default and provide an option to include it
This commit is contained in:
@@ -262,6 +262,31 @@ public abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> {
|
||||
assertThat(textFiles).containsExactly("alpha.txt", "bravo.txt", "charlie.txt");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void devtoolsJarIsExcludedByDefault() throws IOException {
|
||||
this.task.setMainClass("com.example.Main");
|
||||
this.task.classpath(this.temp.newFile("spring-boot-devtools-0.1.2.jar"));
|
||||
this.task.execute();
|
||||
assertThat(this.task.getArchivePath().exists());
|
||||
try (JarFile jarFile = new JarFile(this.task.getArchivePath())) {
|
||||
assertThat(jarFile.getEntry(this.libPath + "/spring-boot-devtools-0.1.2.jar"))
|
||||
.isNull();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void devtoolsJarCanBeIncluded() throws IOException {
|
||||
this.task.setMainClass("com.example.Main");
|
||||
this.task.classpath(this.temp.newFile("spring-boot-devtools-0.1.2.jar"));
|
||||
this.task.setExcludeDevtools(false);
|
||||
this.task.execute();
|
||||
assertThat(this.task.getArchivePath().exists());
|
||||
try (JarFile jarFile = new JarFile(this.task.getArchivePath())) {
|
||||
assertThat(jarFile.getEntry(this.libPath + "/spring-boot-devtools-0.1.2.jar"))
|
||||
.isNotNull();
|
||||
}
|
||||
}
|
||||
|
||||
private T configure(T task) throws IOException {
|
||||
AbstractArchiveTask archiveTask = task;
|
||||
archiveTask.setBaseName("test");
|
||||
|
||||
@@ -47,4 +47,33 @@ public class BootWarTests extends AbstractBootArchiveTests<BootWar> {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void devtoolsJarIsExcludedByDefaultWhenItsOnTheProvidedClasspath()
|
||||
throws IOException {
|
||||
getTask().setMainClass("com.example.Main");
|
||||
getTask().providedClasspath(this.temp.newFile("spring-boot-devtools-0.1.2.jar"));
|
||||
getTask().execute();
|
||||
assertThat(getTask().getArchivePath().exists());
|
||||
try (JarFile jarFile = new JarFile(getTask().getArchivePath())) {
|
||||
assertThat(jarFile
|
||||
.getEntry("WEB-INF/lib-provided/spring-boot-devtools-0.1.2.jar"))
|
||||
.isNull();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void devtoolsJarCanBeIncludedWhenItsOnTheProvidedClasspath()
|
||||
throws IOException {
|
||||
getTask().setMainClass("com.example.Main");
|
||||
getTask().providedClasspath(this.temp.newFile("spring-boot-devtools-0.1.2.jar"));
|
||||
getTask().setExcludeDevtools(false);
|
||||
getTask().execute();
|
||||
assertThat(getTask().getArchivePath().exists());
|
||||
try (JarFile jarFile = new JarFile(getTask().getArchivePath())) {
|
||||
assertThat(jarFile
|
||||
.getEntry("WEB-INF/lib-provided/spring-boot-devtools-0.1.2.jar"))
|
||||
.isNotNull();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user