Merge branch '2.5.x' into 2.6.x

Closes gh-28904
This commit is contained in:
Scott Frederick
2021-12-03 11:42:03 -06:00
5 changed files with 32 additions and 11 deletions

View File

@@ -29,6 +29,7 @@ import java.util.Map;
* @author Dave Syer
* @author Andy Wilkinson
* @author Madhura Bhave
* @author Scott Frederick
* @since 1.0.0
*/
public final class Layouts {
@@ -160,11 +161,6 @@ public final class Layouts {
return "WEB-INF/classes/";
}
@Override
public String getClasspathIndexFileLocation() {
return "WEB-INF/classpath.idx";
}
@Override
public String getLayersIndexFileLocation() {
return "WEB-INF/layers.idx";

View File

@@ -516,15 +516,15 @@ public abstract class Packager {
writtenPaths.add(path);
}
}
if (getLayout() instanceof RepackagingLayout) {
writeClasspathIndex(writtenPaths, (RepackagingLayout) getLayout(), writer);
}
writeClasspathIndexIfNecessary(writtenPaths, getLayout(), writer);
}
private void writeClasspathIndex(List<String> paths, RepackagingLayout layout, AbstractJarWriter writer)
private void writeClasspathIndexIfNecessary(List<String> paths, Layout layout, AbstractJarWriter writer)
throws IOException {
List<String> names = paths.stream().map((path) -> "- \"" + path + "\"").collect(Collectors.toList());
writer.writeIndexFile(layout.getClasspathIndexFileLocation(), names);
if (layout.getClasspathIndexFileLocation() != null) {
List<String> names = paths.stream().map((path) -> "- \"" + path + "\"").collect(Collectors.toList());
writer.writeIndexFile(layout.getClasspathIndexFileLocation(), names);
}
}
/**