Support flat jar layering with Maven
Update the Maven plugin so that layered jars now use the regular "flat" format. The layers.idx file now describes which layer each file should be placed. See gh-20813 Co-authored-by: Phillip Webb <pwebb@pivotal.io>
This commit is contained in:
committed by
Phillip Webb
parent
3f806aa513
commit
4e3cdf936f
@@ -19,7 +19,6 @@ package org.springframework.boot.loader;
|
||||
import java.io.IOException;
|
||||
import java.util.jar.Attributes;
|
||||
import java.util.jar.Manifest;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.springframework.boot.loader.archive.Archive;
|
||||
import org.springframework.boot.loader.archive.Archive.EntryFilter;
|
||||
@@ -37,17 +36,13 @@ import org.springframework.boot.loader.archive.ExplodedArchive;
|
||||
*/
|
||||
public class JarLauncher extends ExecutableArchiveLauncher {
|
||||
|
||||
private static final Pattern CLASSES_PATTERN = Pattern.compile("BOOT-INF\\/(layers\\/.*\\/)?classes/");
|
||||
|
||||
private static final Pattern LIBS_PATTERN = Pattern.compile("BOOT-INF\\/(layers\\/.*\\/)?lib\\/.+");
|
||||
|
||||
private static final String DEFAULT_CLASSPATH_INDEX_LOCATION = "BOOT-INF/classpath.idx";
|
||||
|
||||
static final EntryFilter NESTED_ARCHIVE_ENTRY_FILTER = (entry) -> {
|
||||
if (entry.isDirectory()) {
|
||||
return CLASSES_PATTERN.matcher(entry.getName()).matches();
|
||||
return entry.getName().equals("BOOT-INF/classes/");
|
||||
}
|
||||
return LIBS_PATTERN.matcher(entry.getName()).matches();
|
||||
return entry.getName().startsWith("BOOT-INF/lib/");
|
||||
};
|
||||
|
||||
public JarLauncher() {
|
||||
|
||||
Reference in New Issue
Block a user