Refine layer customization for Maven and Gradle
Simplify layer customization logic for both Maven and Gradle and refactor some internals of the Gradle plugin. Both Maven and Gradle now use a simpler customization format that consists of `application`, `dependencies` and `layer order` sections. The `application`, `dependencies` configurations support one or more `into` blocks that are used to select content for a specific layer. Closes gh-20526
This commit is contained in:
@@ -5,26 +5,23 @@ plugins {
|
||||
|
||||
bootJar {
|
||||
mainClassName = 'com.example.Application'
|
||||
layers {
|
||||
layersOrder "dependencies", "commons-dependencies", "snapshot-dependencies", "static", "app"
|
||||
libraries {
|
||||
layerContent("snapshot-dependencies") { coordinates { include "*:*:*SNAPSHOT" } }
|
||||
layerContent("commons-dependencies") { coordinates { include "org.apache.commons:*" } }
|
||||
layerContent("dependencies") { coordinates { include "*:*" } }
|
||||
}
|
||||
layered {
|
||||
application {
|
||||
layerContent("static") {
|
||||
locations {
|
||||
include "META-INF/resources/**", "resources/**"
|
||||
include "static/**", "public/**"
|
||||
}
|
||||
}
|
||||
layerContent("app") {
|
||||
locations {
|
||||
include "**"
|
||||
}
|
||||
intoLayer("static") {
|
||||
include "META-INF/resources/**", "resources/**", "static/**", "public/**"
|
||||
}
|
||||
intoLayer("app")
|
||||
}
|
||||
dependencies {
|
||||
intoLayer("snapshot-dependencies") {
|
||||
include "*:*:*SNAPSHOT"
|
||||
}
|
||||
intoLayer("commons-dependencies") {
|
||||
include "org.apache.commons:*"
|
||||
}
|
||||
intoLayer("dependencies")
|
||||
}
|
||||
layerOrder "dependencies", "commons-dependencies", "snapshot-dependencies", "static", "app"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ plugins {
|
||||
|
||||
bootJar {
|
||||
mainClassName = 'com.example.Application'
|
||||
layers()
|
||||
layered()
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
||||
@@ -11,7 +11,7 @@ bootJar {
|
||||
}
|
||||
}
|
||||
if (project.hasProperty('layered') && project.getProperty('layered')) {
|
||||
layers {
|
||||
layered {
|
||||
includeLayerTools = project.hasProperty('excludeTools') && project.getProperty('excludeTools') ? false : true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user