-
Notifications
You must be signed in to change notification settings - Fork 41.6k
Closed
Description
Spring Boot 2.3 introduced a new feature where it is possible to create layered .jar files. This is very useful for docker images layer optimization as described in this blog post: https://spring.io/blog/2020/01/27/creating-docker-images-with-spring-boot-2-3-0-m1?#layered-jars
Unfortunately this doesn't work when generating a war file.
Take this build.gradle as an example:
plugins {
id 'org.springframework.boot' version '2.3.1.RELEASE'
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id 'java'
id 'war'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '14'
repositories {
mavenCentral()
}
ext {
set('springCloudVersion', "Hoxton.SR6")
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
}
bootJar {
layered()
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
test {
useJUnitPlatform()
}
As soon as I add the war plugin I start to receive the following error when trying to use the layertools:
$ java -Djarmode=layertools -jar build/libs/demo-0.0.1-SNAPSHOT.war list
Unsupported jarmode 'layertools'
dodgex
Metadata
Metadata
Assignees
Labels
type: enhancementA general enhancementA general enhancement