Stop limiting layer customization to external modules

See gh-21207
This commit is contained in:
Paddy Drury
2020-04-28 10:25:25 +01:00
committed by Andy Wilkinson
parent fe347df5a1
commit 98644df64d
4 changed files with 209 additions and 38 deletions

View File

@@ -0,0 +1,60 @@
plugins {
id 'java'
id 'org.springframework.boot' version '{version}'
}
subprojects {
apply plugin: 'java'
group = 'org.example.projects'
version = '1.2.3'
}
bootJar {
mainClassName = 'com.example.Application'
layered {
application {
intoLayer("static") {
include "META-INF/resources/**", "resources/**", "static/**", "public/**"
}
intoLayer("app")
}
dependencies {
intoLayer("subproject-dependencies") {
include "org.example.projects:*"
}
intoLayer("snapshot-dependencies") {
include "*:*:*SNAPSHOT"
}
intoLayer("commons-dependencies") {
include "org.apache.commons:*"
}
intoLayer("dependencies")
}
layerOrder = ["dependencies", "commons-dependencies", "snapshot-dependencies", "subproject-dependencies", "static", "app"]
}
}
repositories {
mavenCentral()
maven { url "https://repository.apache.org/content/repositories/snapshots" }
}
dependencies {
implementation(project(':foo'))
implementation(project(':bar'))
implementation("commons-io:commons-io:2.7-SNAPSHOT")
implementation("org.apache.commons:commons-lang3:3.9")
implementation("org.springframework:spring-core:5.2.5.RELEASE")
}
task listLayers(type: JavaExec) {
classpath = bootJar.outputs.files
systemProperties = [ "jarmode": "layertools" ]
args "list"
}
task extractLayers(type: JavaExec) {
classpath = bootJar.outputs.files
systemProperties = [ "jarmode": "layertools" ]
args "extract"
}