diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/PropertiesLauncher.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/PropertiesLauncher.java
index 5607a4048d..ab5a0322c7 100644
--- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/PropertiesLauncher.java
+++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/PropertiesLauncher.java
@@ -55,9 +55,10 @@ import org.springframework.boot.loader.util.SystemPropertyUtils;
* extracts optional values (which can also be provided overridden as System properties in
* case the file doesn't exist):
*
- * - {@code loader.path}: a comma-separated list of directories to append to the
- * classpath (containing file resources and/or nested archives in *.jar or *.zip).
- * Defaults to {@code BOOT-INF/classes,BOOT-INF/lib} in your application archive
+ * - {@code loader.path}: a comma-separated list of directories (containing file
+ * resources and/or nested archives in *.jar or *.zip or archives) or archives to append
+ * to the classpath. {@code BOOT-INF/classes,BOOT-INF/lib} in the application archive are
+ * always used
* - {@code loader.main}: the main method to delegate execution to once the class loader
* is set up. No default, but will fall back to looking for a {@code Start-Class} in a
* {@code MANIFEST.MF}, if there is one in
${loader.home}/META-INF.
@@ -78,9 +79,9 @@ public class PropertiesLauncher extends Launcher {
public static final String MAIN = "loader.main";
/**
- * Properties key for classpath entries (directories possibly containing jars).
- * Defaults to "lib/" (relative to {@link #HOME loader home directory}). Multiple
- * entries can be specified using a comma-separated list.
+ * Properties key for classpath entries (directories possibly containing jars or
+ * jars). Multiple entries can be specified using a comma-separated list. {@code
+ * BOOT-INF/classes,BOOT-INF/lib} in the application archive are always used.
*/
public static final String PATH = "loader.path";
@@ -407,10 +408,15 @@ public class PropertiesLauncher extends Launcher {
List lib = new ArrayList();
for (String path : this.paths) {
for (Archive archive : getClassPathArchives(path)) {
- List nested = new ArrayList(
- archive.getNestedArchives(new ArchiveEntryFilter()));
- nested.add(0, archive);
- lib.addAll(nested);
+ if (archive instanceof ExplodedArchive) {
+ List nested = new ArrayList(
+ archive.getNestedArchives(new ArchiveEntryFilter()));
+ nested.add(0, archive);
+ lib.addAll(nested);
+ }
+ else {
+ lib.add(archive);
+ }
}
}
addNestedEntries(lib);
diff --git a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/PropertiesLauncherTests.java b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/PropertiesLauncherTests.java
index a1e81d0d95..9f29293a10 100644
--- a/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/PropertiesLauncherTests.java
+++ b/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/PropertiesLauncherTests.java
@@ -115,6 +115,25 @@ public class PropertiesLauncherTests {
waitFor("Hello World");
}
+ @Test
+ public void testUserSpecifiedJarFileWithNestedArchives() throws Exception {
+ System.setProperty("loader.path", "nested-jars/app.jar");
+ System.setProperty("loader.main", "demo.Application");
+ PropertiesLauncher launcher = new PropertiesLauncher();
+ launcher.launch(new String[0]);
+ waitFor("Hello World");
+ }
+
+ @Test
+ public void testUserSpecifiedDirectoryContainingJarFileWithNestedArchives()
+ throws Exception {
+ System.setProperty("loader.path", "nested-jars");
+ System.setProperty("loader.main", "demo.Application");
+ PropertiesLauncher launcher = new PropertiesLauncher();
+ launcher.launch(new String[0]);
+ waitFor("Hello World");
+ }
+
@Test
public void testUserSpecifiedJarPathWithDot() throws Exception {
System.setProperty("loader.path", "./jars/app.jar");