Merge branch '2.0.x'
This commit is contained in:
@@ -133,6 +133,31 @@ public abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void classpathCanBeSetUsingAFileCollection() throws IOException {
|
||||
this.task.setMainClassName("com.example.Main");
|
||||
this.task.classpath(this.temp.newFile("one.jar"));
|
||||
this.task
|
||||
.setClasspath(this.task.getProject().files(this.temp.newFile("two.jar")));
|
||||
this.task.execute();
|
||||
try (JarFile jarFile = new JarFile(this.task.getArchivePath())) {
|
||||
assertThat(jarFile.getEntry(this.libPath + "/one.jar")).isNull();
|
||||
assertThat(jarFile.getEntry(this.libPath + "/two.jar")).isNotNull();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void classpathCanBeSetUsingAnObject() throws IOException {
|
||||
this.task.setMainClassName("com.example.Main");
|
||||
this.task.classpath(this.temp.newFile("one.jar"));
|
||||
this.task.setClasspath(this.temp.newFile("two.jar"));
|
||||
this.task.execute();
|
||||
try (JarFile jarFile = new JarFile(this.task.getArchivePath())) {
|
||||
assertThat(jarFile.getEntry(this.libPath + "/one.jar")).isNull();
|
||||
assertThat(jarFile.getEntry(this.libPath + "/two.jar")).isNotNull();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void loaderIsWrittenToTheRootOfTheJar() throws IOException {
|
||||
this.task.setMainClassName("com.example.Main");
|
||||
|
||||
@@ -48,6 +48,31 @@ public class BootWarTests extends AbstractBootArchiveTests<BootWar> {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void providedClasspathCanBeSetUsingAFileCollection() throws IOException {
|
||||
getTask().setMainClassName("com.example.Main");
|
||||
getTask().providedClasspath(this.temp.newFile("one.jar"));
|
||||
getTask().setProvidedClasspath(
|
||||
getTask().getProject().files(this.temp.newFile("two.jar")));
|
||||
getTask().execute();
|
||||
try (JarFile jarFile = new JarFile(getTask().getArchivePath())) {
|
||||
assertThat(jarFile.getEntry("WEB-INF/lib-provided/one.jar")).isNull();
|
||||
assertThat(jarFile.getEntry("WEB-INF/lib-provided/two.jar")).isNotNull();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void providedClasspathCanBeSetUsingAnObject() throws IOException {
|
||||
getTask().setMainClassName("com.example.Main");
|
||||
getTask().providedClasspath(this.temp.newFile("one.jar"));
|
||||
getTask().setProvidedClasspath(this.temp.newFile("two.jar"));
|
||||
getTask().execute();
|
||||
try (JarFile jarFile = new JarFile(getTask().getArchivePath())) {
|
||||
assertThat(jarFile.getEntry("WEB-INF/lib-provided/one.jar")).isNull();
|
||||
assertThat(jarFile.getEntry("WEB-INF/lib-provided/two.jar")).isNotNull();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void devtoolsJarIsExcludedByDefaultWhenItsOnTheProvidedClasspath()
|
||||
throws IOException {
|
||||
|
||||
Reference in New Issue
Block a user