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:
Phillip Webb
2020-03-24 17:00:39 -07:00
parent 14718f3e8a
commit 7bc7d86ad4
61 changed files with 2047 additions and 2054 deletions

View File

@@ -9,27 +9,17 @@ bootJar {
// tag::layered[]
bootJar {
layers {
layersOrder "dependencies", "snapshot-dependencies", "application"
libraries {
layerContent("snapshot-dependencies") {
coordinates {
include "*:*:*SNAPSHOT"
}
}
layerContent("dependencies") {
coordinates {
include "*:*"
}
}
}
layered {
application {
layerContent("application") {
locations {
include "**"
}
}
intoLayer("application")
}
dependencies {
intoLayer("snapshot-dependencies") {
include "*:*:*SNAPSHOT"
}
intoLayer("dependencies")
}
layerOrder "dependencies", "snapshot-dependencies", "application"
}
}
// end::layered[]

View File

@@ -7,27 +7,17 @@ plugins {
// tag::layered[]
tasks.getByName<BootJar>("bootJar") {
layers {
layersOrder("dependencies", "snapshot-dependencies", "application")
libraries {
layerContent("snapshot-dependencies") {
coordinates {
include("*:*:*SNAPSHOT")
}
}
layerContent("dependencies") {
coordinates {
include("*:*")
}
}
}
layered {
application {
layerContent("application") {
locations {
include("**")
}
}
intoLayer("application")
}
dependencies {
intoLayer("snapshot-dependencies") {
include("*:*:*SNAPSHOT")
}
intoLayer("dependencies") {
}
layersOrder("dependencies", "snapshot-dependencies", "application")
}
}
// end::layered[]

View File

@@ -9,6 +9,6 @@ bootJar {
// tag::layered[]
bootJar {
layers()
layered()
}
// end::layered[]

View File

@@ -11,6 +11,6 @@ tasks.getByName<BootJar>("bootJar") {
// tag::layered[]
tasks.getByName<BootJar>("bootJar") {
layers()
layered()
}
// end::layered[]