@ -99,7 +99,7 @@ abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> {
@Test
@Test
void basicArchiveCreation ( ) throws IOException {
void basicArchiveCreation ( ) throws IOException {
this . task . setMainClassName ( "com.example.Main" ) ;
this . task . getMainClass( ) . set ( "com.example.Main" ) ;
executeTask ( ) ;
executeTask ( ) ;
try ( JarFile jarFile = new JarFile ( this . task . getArchiveFile ( ) . get ( ) . getAsFile ( ) ) ) {
try ( JarFile jarFile = new JarFile ( this . task . getArchiveFile ( ) . get ( ) . getAsFile ( ) ) ) {
assertThat ( jarFile . getManifest ( ) . getMainAttributes ( ) . getValue ( "Main-Class" ) ) . isEqualTo ( this . launcherClass ) ;
assertThat ( jarFile . getManifest ( ) . getMainAttributes ( ) . getValue ( "Main-Class" ) ) . isEqualTo ( this . launcherClass ) ;
@ -113,7 +113,7 @@ abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> {
@Test
@Test
void classpathJarsArePackagedBeneathLibPathAndAreStored ( ) throws IOException {
void classpathJarsArePackagedBeneathLibPathAndAreStored ( ) throws IOException {
this . task . setMainClassName ( "com.example.Main" ) ;
this . task . getMainClass( ) . set ( "com.example.Main" ) ;
this . task . classpath ( jarFile ( "one.jar" ) , jarFile ( "two.jar" ) ) ;
this . task . classpath ( jarFile ( "one.jar" ) , jarFile ( "two.jar" ) ) ;
executeTask ( ) ;
executeTask ( ) ;
try ( JarFile jarFile = new JarFile ( this . task . getArchiveFile ( ) . get ( ) . getAsFile ( ) ) ) {
try ( JarFile jarFile = new JarFile ( this . task . getArchiveFile ( ) . get ( ) . getAsFile ( ) ) ) {
@ -126,7 +126,7 @@ abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> {
@Test
@Test
void classpathDirectoriesArePackagedBeneathClassesPath ( ) throws IOException {
void classpathDirectoriesArePackagedBeneathClassesPath ( ) throws IOException {
this . task . setMainClassName ( "com.example.Main" ) ;
this . task . getMainClass( ) . set ( "com.example.Main" ) ;
File classpathDirectory = new File ( this . temp , "classes" ) ;
File classpathDirectory = new File ( this . temp , "classes" ) ;
File applicationClass = new File ( classpathDirectory , "com/example/Application.class" ) ;
File applicationClass = new File ( classpathDirectory , "com/example/Application.class" ) ;
applicationClass . getParentFile ( ) . mkdirs ( ) ;
applicationClass . getParentFile ( ) . mkdirs ( ) ;
@ -140,7 +140,7 @@ abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> {
@Test
@Test
void moduleInfoClassIsPackagedInTheRootOfTheArchive ( ) throws IOException {
void moduleInfoClassIsPackagedInTheRootOfTheArchive ( ) throws IOException {
this . task . setMainClassName ( "com.example.Main" ) ;
this . task . getMainClass( ) . set ( "com.example.Main" ) ;
File classpathDirectory = new File ( this . temp , "classes" ) ;
File classpathDirectory = new File ( this . temp , "classes" ) ;
File moduleInfoClass = new File ( classpathDirectory , "module-info.class" ) ;
File moduleInfoClass = new File ( classpathDirectory , "module-info.class" ) ;
moduleInfoClass . getParentFile ( ) . mkdirs ( ) ;
moduleInfoClass . getParentFile ( ) . mkdirs ( ) ;
@ -160,7 +160,7 @@ abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> {
@Test
@Test
void classpathCanBeSetUsingAFileCollection ( ) throws IOException {
void classpathCanBeSetUsingAFileCollection ( ) throws IOException {
this . task . setMainClassName ( "com.example.Main" ) ;
this . task . getMainClass( ) . set ( "com.example.Main" ) ;
this . task . classpath ( jarFile ( "one.jar" ) ) ;
this . task . classpath ( jarFile ( "one.jar" ) ) ;
this . task . setClasspath ( this . task . getProject ( ) . files ( jarFile ( "two.jar" ) ) ) ;
this . task . setClasspath ( this . task . getProject ( ) . files ( jarFile ( "two.jar" ) ) ) ;
executeTask ( ) ;
executeTask ( ) ;
@ -172,7 +172,7 @@ abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> {
@Test
@Test
void classpathCanBeSetUsingAnObject ( ) throws IOException {
void classpathCanBeSetUsingAnObject ( ) throws IOException {
this . task . setMainClassName ( "com.example.Main" ) ;
this . task . getMainClass( ) . set ( "com.example.Main" ) ;
this . task . classpath ( jarFile ( "one.jar" ) ) ;
this . task . classpath ( jarFile ( "one.jar" ) ) ;
this . task . setClasspath ( jarFile ( "two.jar" ) ) ;
this . task . setClasspath ( jarFile ( "two.jar" ) ) ;
executeTask ( ) ;
executeTask ( ) ;
@ -184,7 +184,7 @@ abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> {
@Test
@Test
void filesOnTheClasspathThatAreNotZipFilesAreSkipped ( ) throws IOException {
void filesOnTheClasspathThatAreNotZipFilesAreSkipped ( ) throws IOException {
this . task . setMainClassName ( "com.example.Main" ) ;
this . task . getMainClass( ) . set ( "com.example.Main" ) ;
this . task . classpath ( new File ( "test.pom" ) ) ;
this . task . classpath ( new File ( "test.pom" ) ) ;
executeTask ( ) ;
executeTask ( ) ;
try ( JarFile jarFile = new JarFile ( this . task . getArchiveFile ( ) . get ( ) . getAsFile ( ) ) ) {
try ( JarFile jarFile = new JarFile ( this . task . getArchiveFile ( ) . get ( ) . getAsFile ( ) ) ) {
@ -194,7 +194,7 @@ abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> {
@Test
@Test
void loaderIsWrittenToTheRootOfTheJarAfterManifest ( ) throws IOException {
void loaderIsWrittenToTheRootOfTheJarAfterManifest ( ) throws IOException {
this . task . setMainClassName ( "com.example.Main" ) ;
this . task . getMainClass( ) . set ( "com.example.Main" ) ;
executeTask ( ) ;
executeTask ( ) ;
try ( JarFile jarFile = new JarFile ( this . task . getArchiveFile ( ) . get ( ) . getAsFile ( ) ) ) {
try ( JarFile jarFile = new JarFile ( this . task . getArchiveFile ( ) . get ( ) . getAsFile ( ) ) ) {
assertThat ( jarFile . getEntry ( "org/springframework/boot/loader/LaunchedURLClassLoader.class" ) ) . isNotNull ( ) ;
assertThat ( jarFile . getEntry ( "org/springframework/boot/loader/LaunchedURLClassLoader.class" ) ) . isNotNull ( ) ;
@ -210,7 +210,7 @@ abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> {
@Test
@Test
void loaderIsWrittenToTheRootOfTheJarWhenUsingThePropertiesLauncher ( ) throws IOException {
void loaderIsWrittenToTheRootOfTheJarWhenUsingThePropertiesLauncher ( ) throws IOException {
this . task . setMainClassName ( "com.example.Main" ) ;
this . task . getMainClass( ) . set ( "com.example.Main" ) ;
executeTask ( ) ;
executeTask ( ) ;
this . task . getManifest ( ) . getAttributes ( ) . put ( "Main-Class" , "org.springframework.boot.loader.PropertiesLauncher" ) ;
this . task . getManifest ( ) . getAttributes ( ) . put ( "Main-Class" , "org.springframework.boot.loader.PropertiesLauncher" ) ;
try ( JarFile jarFile = new JarFile ( this . task . getArchiveFile ( ) . get ( ) . getAsFile ( ) ) ) {
try ( JarFile jarFile = new JarFile ( this . task . getArchiveFile ( ) . get ( ) . getAsFile ( ) ) ) {
@ -221,7 +221,7 @@ abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> {
@Test
@Test
void unpackCommentIsAddedToEntryIdentifiedByAPattern ( ) throws IOException {
void unpackCommentIsAddedToEntryIdentifiedByAPattern ( ) throws IOException {
this . task . setMainClassName ( "com.example.Main" ) ;
this . task . getMainClass( ) . set ( "com.example.Main" ) ;
this . task . classpath ( jarFile ( "one.jar" ) , jarFile ( "two.jar" ) ) ;
this . task . classpath ( jarFile ( "one.jar" ) , jarFile ( "two.jar" ) ) ;
this . task . requiresUnpack ( "**/one.jar" ) ;
this . task . requiresUnpack ( "**/one.jar" ) ;
executeTask ( ) ;
executeTask ( ) ;
@ -233,7 +233,7 @@ abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> {
@Test
@Test
void unpackCommentIsAddedToEntryIdentifiedByASpec ( ) throws IOException {
void unpackCommentIsAddedToEntryIdentifiedByASpec ( ) throws IOException {
this . task . setMainClassName ( "com.example.Main" ) ;
this . task . getMainClass( ) . set ( "com.example.Main" ) ;
this . task . classpath ( jarFile ( "one.jar" ) , jarFile ( "two.jar" ) ) ;
this . task . classpath ( jarFile ( "one.jar" ) , jarFile ( "two.jar" ) ) ;
this . task . requiresUnpack ( ( element ) - > element . getName ( ) . endsWith ( "two.jar" ) ) ;
this . task . requiresUnpack ( ( element ) - > element . getName ( ) . endsWith ( "two.jar" ) ) ;
executeTask ( ) ;
executeTask ( ) ;
@ -245,7 +245,7 @@ abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> {
@Test
@Test
void launchScriptCanBePrepended ( ) throws IOException {
void launchScriptCanBePrepended ( ) throws IOException {
this . task . setMainClassName ( "com.example.Main" ) ;
this . task . getMainClass( ) . set ( "com.example.Main" ) ;
this . task . launchScript ( ) ;
this . task . launchScript ( ) ;
executeTask ( ) ;
executeTask ( ) ;
Map < String , String > properties = new HashMap < > ( ) ;
Map < String , String > properties = new HashMap < > ( ) ;
@ -266,7 +266,7 @@ abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> {
@Test
@Test
void customLaunchScriptCanBePrepended ( ) throws IOException {
void customLaunchScriptCanBePrepended ( ) throws IOException {
this . task . setMainClassName ( "com.example.Main" ) ;
this . task . getMainClass( ) . set ( "com.example.Main" ) ;
File customScript = new File ( this . temp , "custom.script" ) ;
File customScript = new File ( this . temp , "custom.script" ) ;
Files . write ( customScript . toPath ( ) , Arrays . asList ( "custom script" ) , StandardOpenOption . CREATE ) ;
Files . write ( customScript . toPath ( ) , Arrays . asList ( "custom script" ) , StandardOpenOption . CREATE ) ;
this . task . launchScript ( ( configuration ) - > configuration . setScript ( customScript ) ) ;
this . task . launchScript ( ( configuration ) - > configuration . setScript ( customScript ) ) ;
@ -277,7 +277,7 @@ abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> {
@Test
@Test
void launchScriptInitInfoPropertiesCanBeCustomized ( ) throws IOException {
void launchScriptInitInfoPropertiesCanBeCustomized ( ) throws IOException {
this . task . setMainClassName ( "com.example.Main" ) ;
this . task . getMainClass( ) . set ( "com.example.Main" ) ;
this . task . launchScript ( ( configuration ) - > {
this . task . launchScript ( ( configuration ) - > {
configuration . getProperties ( ) . put ( "initInfoProvides" , "provides" ) ;
configuration . getProperties ( ) . put ( "initInfoProvides" , "provides" ) ;
configuration . getProperties ( ) . put ( "initInfoShortDescription" , "short description" ) ;
configuration . getProperties ( ) . put ( "initInfoShortDescription" , "short description" ) ;
@ -292,7 +292,7 @@ abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> {
@Test
@Test
void customMainClassInTheManifestIsHonored ( ) throws IOException {
void customMainClassInTheManifestIsHonored ( ) throws IOException {
this . task . setMainClassName ( "com.example.Main" ) ;
this . task . getMainClass( ) . set ( "com.example.Main" ) ;
this . task . getManifest ( ) . getAttributes ( ) . put ( "Main-Class" , "com.example.CustomLauncher" ) ;
this . task . getManifest ( ) . getAttributes ( ) . put ( "Main-Class" , "com.example.CustomLauncher" ) ;
executeTask ( ) ;
executeTask ( ) ;
assertThat ( this . task . getArchiveFile ( ) . get ( ) . getAsFile ( ) ) . exists ( ) ;
assertThat ( this . task . getArchiveFile ( ) . get ( ) . getAsFile ( ) ) . exists ( ) ;
@ -306,7 +306,7 @@ abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> {
@Test
@Test
void customStartClassInTheManifestIsHonored ( ) throws IOException {
void customStartClassInTheManifestIsHonored ( ) throws IOException {
this . task . setMainClassName ( "com.example.Main" ) ;
this . task . getMainClass( ) . set ( "com.example.Main" ) ;
this . task . getManifest ( ) . getAttributes ( ) . put ( "Start-Class" , "com.example.CustomMain" ) ;
this . task . getManifest ( ) . getAttributes ( ) . put ( "Start-Class" , "com.example.CustomMain" ) ;
executeTask ( ) ;
executeTask ( ) ;
assertThat ( this . task . getArchiveFile ( ) . get ( ) . getAsFile ( ) ) . exists ( ) ;
assertThat ( this . task . getArchiveFile ( ) . get ( ) . getAsFile ( ) ) . exists ( ) ;
@ -319,7 +319,7 @@ abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> {
@Test
@Test
void fileTimestampPreservationCanBeDisabled ( ) throws IOException {
void fileTimestampPreservationCanBeDisabled ( ) throws IOException {
this . task . setMainClassName ( "com.example.Main" ) ;
this . task . getMainClass( ) . set ( "com.example.Main" ) ;
this . task . setPreserveFileTimestamps ( false ) ;
this . task . setPreserveFileTimestamps ( false ) ;
executeTask ( ) ;
executeTask ( ) ;
assertThat ( this . task . getArchiveFile ( ) . get ( ) . getAsFile ( ) ) . exists ( ) ;
assertThat ( this . task . getArchiveFile ( ) . get ( ) . getAsFile ( ) ) . exists ( ) ;
@ -340,7 +340,7 @@ abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> {
@Test
@Test
void reproducibleOrderingCanBeEnabled ( ) throws IOException {
void reproducibleOrderingCanBeEnabled ( ) throws IOException {
this . task . setMainClassName ( "com.example.Main" ) ;
this . task . getMainClass( ) . set ( "com.example.Main" ) ;
this . task . from ( newFile ( "bravo.txt" ) , newFile ( "alpha.txt" ) , newFile ( "charlie.txt" ) ) ;
this . task . from ( newFile ( "bravo.txt" ) , newFile ( "alpha.txt" ) , newFile ( "charlie.txt" ) ) ;
this . task . setReproducibleFileOrder ( true ) ;
this . task . setReproducibleFileOrder ( true ) ;
executeTask ( ) ;
executeTask ( ) ;
@ -360,7 +360,7 @@ abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> {
@Test
@Test
void devtoolsJarIsExcludedByDefault ( ) throws IOException {
void devtoolsJarIsExcludedByDefault ( ) throws IOException {
this . task . setMainClassName ( "com.example.Main" ) ;
this . task . getMainClass( ) . set ( "com.example.Main" ) ;
this . task . classpath ( newFile ( "spring-boot-devtools-0.1.2.jar" ) ) ;
this . task . classpath ( newFile ( "spring-boot-devtools-0.1.2.jar" ) ) ;
executeTask ( ) ;
executeTask ( ) ;
assertThat ( this . task . getArchiveFile ( ) . get ( ) . getAsFile ( ) ) . exists ( ) ;
assertThat ( this . task . getArchiveFile ( ) . get ( ) . getAsFile ( ) ) . exists ( ) ;
@ -372,7 +372,7 @@ abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> {
@Test
@Test
@Deprecated
@Deprecated
void devtoolsJarCanBeIncluded ( ) throws IOException {
void devtoolsJarCanBeIncluded ( ) throws IOException {
this . task . setMainClassName ( "com.example.Main" ) ;
this . task . getMainClass( ) . set ( "com.example.Main" ) ;
this . task . classpath ( jarFile ( "spring-boot-devtools-0.1.2.jar" ) ) ;
this . task . classpath ( jarFile ( "spring-boot-devtools-0.1.2.jar" ) ) ;
this . task . setExcludeDevtools ( false ) ;
this . task . setExcludeDevtools ( false ) ;
executeTask ( ) ;
executeTask ( ) ;
@ -384,7 +384,7 @@ abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> {
@Test
@Test
void allEntriesUseUnixPlatformAndUtf8NameEncoding ( ) throws IOException {
void allEntriesUseUnixPlatformAndUtf8NameEncoding ( ) throws IOException {
this . task . setMainClassName ( "com.example.Main" ) ;
this . task . getMainClass( ) . set ( "com.example.Main" ) ;
this . task . setMetadataCharset ( "UTF-8" ) ;
this . task . setMetadataCharset ( "UTF-8" ) ;
File classpathDirectory = new File ( this . temp , "classes" ) ;
File classpathDirectory = new File ( this . temp , "classes" ) ;
File resource = new File ( classpathDirectory , "some-resource.xml" ) ;
File resource = new File ( classpathDirectory , "some-resource.xml" ) ;
@ -405,7 +405,7 @@ abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> {
@Test
@Test
void loaderIsWrittenFirstThenApplicationClassesThenLibraries ( ) throws IOException {
void loaderIsWrittenFirstThenApplicationClassesThenLibraries ( ) throws IOException {
this . task . setMainClassName ( "com.example.Main" ) ;
this . task . getMainClass( ) . set ( "com.example.Main" ) ;
File classpathDirectory = new File ( this . temp , "classes" ) ;
File classpathDirectory = new File ( this . temp , "classes" ) ;
File applicationClass = new File ( classpathDirectory , "com/example/Application.class" ) ;
File applicationClass = new File ( classpathDirectory , "com/example/Application.class" ) ;
applicationClass . getParentFile ( ) . mkdirs ( ) ;
applicationClass . getParentFile ( ) . mkdirs ( ) ;