Add classpath index support for exploded war archives
Update the Maven and Gradle packaging for war files so that a `classpath.idx` file is written into the archive that provides the original order of the classpath, as was previously done for jar files. The `WarLauncher` class will use this file when running as an exploded archive to ensure that the classpath order is the same as when running from the far war. Fixes gh-19875
This commit is contained in:
@@ -41,6 +41,7 @@ import org.gradle.api.tasks.bundling.War;
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
* @author Phillip Webb
|
||||
* @author Scott Frederick
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public class BootWar extends War implements BootArchive {
|
||||
@@ -55,6 +56,8 @@ public class BootWar extends War implements BootArchive {
|
||||
|
||||
private static final String LAYERS_INDEX = "WEB-INF/layers.idx";
|
||||
|
||||
private static final String CLASSPATH_INDEX = "WEB-INF/classpath.idx";
|
||||
|
||||
private final BootArchiveSupport support;
|
||||
|
||||
private final Property<String> mainClass;
|
||||
@@ -91,8 +94,8 @@ public class BootWar extends War implements BootArchive {
|
||||
|
||||
@Override
|
||||
public void copy() {
|
||||
this.support.configureManifest(getManifest(), getMainClass().get(), CLASSES_DIRECTORY, LIB_DIRECTORY, null,
|
||||
(isLayeredDisabled()) ? null : LAYERS_INDEX);
|
||||
this.support.configureManifest(getManifest(), getMainClass().get(), CLASSES_DIRECTORY, LIB_DIRECTORY,
|
||||
CLASSPATH_INDEX, (isLayeredDisabled()) ? null : LAYERS_INDEX);
|
||||
super.copy();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user