Repackaging application with layer=WAR:

        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <layout>WAR</layout>
                <layers>
                    <enabled>true</enabled>
                </layers>
            </configuration>
        </plugin>

throws Exception: [ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.3.2.RELEASE:repackage (repackage) on project rob-oro: A type incompatibility occurred while executing org.springframework.boot:spring-boot-maven-plugin:2.3.2.RELEASE:repackage: class org.springframework.boot.loader.tools.Layouts$War cannot be cast to class org.springframework.boot.loader.tools.RepackagingLayout (org.springframework.boot.loader.tools.Layouts$War and org.springframework.boot.loader.tools.RepackagingLayout are in unnamed module of loader org.codehaus.plexus.classworlds.realm.ClassRealm @5b1f0f26)

JAR layout is working. I think WAR layout should also implement RepackagingLayout:

public static class Layouts.War extends Object implements Layout

public static class Layouts.Jar extends Object implements RepackagingLayout

Comment From: wilkinsona

Thanks for the report. We don't support layered war files at the moment. https://github.com/spring-projects/spring-boot/issues/22195 is tracking that enhancement.

Comment From: wilkinsona

I've updated #22195 to focus on Gradle support for layered war files. Let's use this issue for the Maven side of things.

Comment From: mbhave

Keeping the issue open to add documentation once the gradle issue is completed.