Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
952e5297
Commit
952e5297
authored
Mar 23, 2020
by
Madhura Bhave
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename "classes" to "application" in custom layer configuration
Closes gh-20539
parent
29c89f3c
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
27 additions
and
26 deletions
+27
-26
boot-jar-layered-custom.gradle
.../src/docs/gradle/packaging/boot-jar-layered-custom.gradle
+1
-1
boot-jar-layered-custom.gradle.kts
.../docs/gradle/packaging/boot-jar-layered-custom.gradle.kts
+1
-1
BootJar.java
...g/springframework/boot/gradle/tasks/bundling/BootJar.java
+1
-1
LayerConfiguration.java
...mework/boot/gradle/tasks/bundling/LayerConfiguration.java
+5
-4
BootJarTests.java
...ingframework/boot/gradle/tasks/bundling/BootJarTests.java
+1
-1
BootJarIntegrationTests-customLayers.gradle
...asks/bundling/BootJarIntegrationTests-customLayers.gradle
+1
-1
packaging.adoc
...spring-boot-maven-plugin/src/docs/asciidoc/packaging.adoc
+4
-4
layers.xml
...rc/intTest/projects/jar-layered-custom/jar/src/layers.xml
+2
-2
CustomLayersProvider.java
.../org/springframework/boot/maven/CustomLayersProvider.java
+1
-1
layers-configuration.xsd
...g-boot-maven-plugin/src/main/xsd/layers-configuration.xsd
+6
-6
layers.xml
...ls/spring-boot-maven-plugin/src/test/resources/layers.xml
+2
-2
resource-layer-no-filter.xml
...en-plugin/src/test/resources/resource-layer-no-filter.xml
+2
-2
No files found.
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-layered-custom.gradle
View file @
952e5297
...
@@ -23,7 +23,7 @@ bootJar {
...
@@ -23,7 +23,7 @@ bootJar {
}
}
}
}
}
}
classes
{
application
{
layerContent
(
"resources"
)
{
layerContent
(
"resources"
)
{
locations
{
locations
{
include
"META-INF/resources/**"
,
"resources/**"
include
"META-INF/resources/**"
,
"resources/**"
...
...
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-layered-custom.gradle.kts
View file @
952e5297
...
@@ -21,7 +21,7 @@ tasks.getByName<BootJar>("bootJar") {
...
@@ -21,7 +21,7 @@ tasks.getByName<BootJar>("bootJar") {
}
}
}
}
}
}
classes
{
application
{
layerContent
(
"resources"
)
{
layerContent
(
"resources"
)
{
locations
{
locations
{
include
(
"META-INF/resources/**"
,
"resources/**"
)
include
(
"META-INF/resources/**"
,
"resources/**"
)
...
...
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootJar.java
View file @
952e5297
...
@@ -214,7 +214,7 @@ public class BootJar extends Jar implements BootArchive {
...
@@ -214,7 +214,7 @@ public class BootJar extends Jar implements BootArchive {
else
{
else
{
List
<
Layer
>
customLayers
=
this
.
layerConfiguration
.
getLayersOrder
().
stream
().
map
(
Layer:
:
new
)
List
<
Layer
>
customLayers
=
this
.
layerConfiguration
.
getLayersOrder
().
stream
().
map
(
Layer:
:
new
)
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
this
.
layers
=
new
CustomLayers
(
customLayers
,
this
.
layerConfiguration
.
get
Classes
(),
this
.
layers
=
new
CustomLayers
(
customLayers
,
this
.
layerConfiguration
.
get
Application
(),
this
.
layerConfiguration
.
getLibraries
());
this
.
layerConfiguration
.
getLibraries
());
}
}
...
...
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/LayerConfiguration.java
View file @
952e5297
...
@@ -79,16 +79,16 @@ public class LayerConfiguration {
...
@@ -79,16 +79,16 @@ public class LayerConfiguration {
}
}
@Input
@Input
public
List
<
ResourceStrategy
>
get
Classes
()
{
public
List
<
ResourceStrategy
>
get
Application
()
{
return
this
.
resourceStrategies
;
return
this
.
resourceStrategies
;
}
}
public
void
classes
(
ResourceStrategy
...
resourceStrategies
)
{
public
void
application
(
ResourceStrategy
...
resourceStrategies
)
{
assertLayersOrderConfigured
();
assertLayersOrderConfigured
();
this
.
resourceStrategies
=
Arrays
.
asList
(
resourceStrategies
);
this
.
resourceStrategies
=
Arrays
.
asList
(
resourceStrategies
);
}
}
public
void
classes
(
Action
<
LayerConfiguration
>
config
)
{
public
void
application
(
Action
<
LayerConfiguration
>
config
)
{
assertLayersOrderConfigured
();
assertLayersOrderConfigured
();
this
.
strategySpec
=
StrategySpec
.
forResources
();
this
.
strategySpec
=
StrategySpec
.
forResources
();
config
.
execute
(
this
);
config
.
execute
(
this
);
...
@@ -135,7 +135,8 @@ public class LayerConfiguration {
...
@@ -135,7 +135,8 @@ public class LayerConfiguration {
}
}
public
void
locations
(
Action
<
LayerConfiguration
>
config
)
{
public
void
locations
(
Action
<
LayerConfiguration
>
config
)
{
Assert
.
state
(
this
.
strategySpec
.
isResourcesStrategy
(),
"The 'locations' filter must be used only with classes"
);
Assert
.
state
(
this
.
strategySpec
.
isResourcesStrategy
(),
"The 'locations' filter must be used only with application"
);
this
.
strategySpec
.
newFilter
();
this
.
strategySpec
.
newFilter
();
config
.
execute
(
this
);
config
.
execute
(
this
);
this
.
strategySpec
this
.
strategySpec
...
...
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootJarTests.java
View file @
952e5297
...
@@ -126,7 +126,7 @@ class BootJarTests extends AbstractBootArchiveTests<BootJar> {
...
@@ -126,7 +126,7 @@ class BootJarTests extends AbstractBootArchiveTests<BootJar> {
configuration
.
libraries
(
createLibraryStrategy
(
"my-snapshot-deps"
,
"com.example:*:*.SNAPSHOT"
),
configuration
.
libraries
(
createLibraryStrategy
(
"my-snapshot-deps"
,
"com.example:*:*.SNAPSHOT"
),
createLibraryStrategy
(
"my-internal-deps"
,
"com.example:*:*"
),
createLibraryStrategy
(
"my-internal-deps"
,
"com.example:*:*"
),
createLibraryStrategy
(
"my-deps"
,
"*:*"
));
createLibraryStrategy
(
"my-deps"
,
"*:*"
));
configuration
.
classes
(
createResourceStrategy
(
"resources"
,
"static/**"
),
configuration
.
application
(
createResourceStrategy
(
"resources"
,
"static/**"
),
createResourceStrategy
(
"application"
,
"**"
));
createResourceStrategy
(
"application"
,
"**"
));
});
});
List
<
String
>
entryNames
=
getEntryNames
(
jar
);
List
<
String
>
entryNames
=
getEntryNames
(
jar
);
...
...
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/tasks/bundling/BootJarIntegrationTests-customLayers.gradle
View file @
952e5297
...
@@ -12,7 +12,7 @@ bootJar {
...
@@ -12,7 +12,7 @@ bootJar {
layerContent
(
"commons-dependencies"
)
{
coordinates
{
include
"org.apache.commons:*"
}
}
layerContent
(
"commons-dependencies"
)
{
coordinates
{
include
"org.apache.commons:*"
}
}
layerContent
(
"dependencies"
)
{
coordinates
{
include
"*:*"
}
}
layerContent
(
"dependencies"
)
{
coordinates
{
include
"*:*"
}
}
}
}
classes
{
application
{
layerContent
(
"static"
)
{
layerContent
(
"static"
)
{
locations
{
locations
{
include
"META-INF/resources/**"
,
"resources/**"
include
"META-INF/resources/**"
,
"resources/**"
...
...
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/packaging.adoc
View file @
952e5297
...
@@ -164,7 +164,7 @@ The following example shows what the implicit layer configuration described abov
...
@@ -164,7 +164,7 @@ The following example shows what the implicit layer configuration described abov
</coordinates>
</coordinates>
</layer-content>
</layer-content>
</libraries>
</libraries>
<
classes
>
<
application
>
<layer-content layer="resources">
<layer-content layer="resources">
<locations>
<locations>
<include>META-INF/resources/**</include>
<include>META-INF/resources/**</include>
...
@@ -178,7 +178,7 @@ The following example shows what the implicit layer configuration described abov
...
@@ -178,7 +178,7 @@ The following example shows what the implicit layer configuration described abov
<include>**</include>
<include>**</include>
</locations>
</locations>
</layer-content>
</layer-content>
</
classes
>
</
application
>
</layers-configuration>
</layers-configuration>
----
----
...
@@ -589,9 +589,9 @@ This allows to reuse the cache for external dependencies when an internal depend
...
@@ -589,9 +589,9 @@ This allows to reuse the cache for external dependencies when an internal depend
</coordinates>
</coordinates>
</layer-content>
</layer-content>
</libraries>
</libraries>
<
classes
>
<
application
>
...
...
</
classes
>
</
application
>
</layers-configuration>
</layers-configuration>
----
----
...
...
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/jar-layered-custom/jar/src/layers.xml
View file @
952e5297
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
</coordinates>
</coordinates>
</layer-content>
</layer-content>
</libraries>
</libraries>
<
classes
>
<
application
>
<layer-content
layer=
"configuration"
>
<layer-content
layer=
"configuration"
>
<locations>
<locations>
<include>
**/application*.*
</include>
<include>
**/application*.*
</include>
...
@@ -31,5 +31,5 @@
...
@@ -31,5 +31,5 @@
<include>
**
</include>
<include>
**
</include>
</locations>
</locations>
</layer-content>
</layer-content>
</
classes
>
</
application
>
</layers-configuration>
</layers-configuration>
\ No newline at end of file
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/CustomLayersProvider.java
View file @
952e5297
...
@@ -71,7 +71,7 @@ public class CustomLayersProvider {
...
@@ -71,7 +71,7 @@ public class CustomLayersProvider {
(
StrategyFactory
<
LibraryFilter
,
LibraryStrategy
>)
FilteredLibraryStrategy:
:
new
,
(
StrategyFactory
<
LibraryFilter
,
LibraryStrategy
>)
FilteredLibraryStrategy:
:
new
,
CoordinateFilter:
:
new
,
"coordinates"
::
equals
));
CoordinateFilter:
:
new
,
"coordinates"
::
equals
));
}
}
if
(
"
classes
"
.
equals
(
nodeName
))
{
if
(
"
application
"
.
equals
(
nodeName
))
{
resourceStrategies
.
addAll
(
getStrategies
(
contents
,
resourceStrategies
.
addAll
(
getStrategies
(
contents
,
(
StrategyFactory
<
ResourceFilter
,
ResourceStrategy
>)
FilteredResourceStrategy:
:
new
,
(
StrategyFactory
<
ResourceFilter
,
ResourceStrategy
>)
FilteredResourceStrategy:
:
new
,
LocationFilter:
:
new
,
"locations"
::
equals
));
LocationFilter:
:
new
,
"locations"
::
equals
));
...
...
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/xsd/layers-configuration.xsd
View file @
952e5297
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
<xsd:sequence>
<xsd:sequence>
<xsd:element
type=
"layersType"
name=
"layers"
/>
<xsd:element
type=
"layersType"
name=
"layers"
/>
<xsd:element
type=
"librariesType"
name=
"libraries"
minOccurs=
"0"
/>
<xsd:element
type=
"librariesType"
name=
"libraries"
minOccurs=
"0"
/>
<xsd:element
type=
"
classesType"
name=
"classes
"
minOccurs=
"0"
/>
<xsd:element
type=
"
applicationType"
name=
"application
"
minOccurs=
"0"
/>
</xsd:sequence>
</xsd:sequence>
</xsd:complexType>
</xsd:complexType>
<xsd:complexType
name=
"layersType"
>
<xsd:complexType
name=
"layersType"
>
...
@@ -48,25 +48,25 @@
...
@@ -48,25 +48,25 @@
</xsd:sequence>
</xsd:sequence>
<xsd:attribute
type=
"xsd:string"
name=
"layer"
use=
"required"
/>
<xsd:attribute
type=
"xsd:string"
name=
"layer"
use=
"required"
/>
</xsd:complexType>
</xsd:complexType>
<xsd:complexType
name=
"
classes
Type"
>
<xsd:complexType
name=
"
application
Type"
>
<xsd:annotation>
<xsd:annotation>
<xsd:documentation>
<![CDATA[
<xsd:documentation>
<![CDATA[
Strategies that should be applied to
class
es. If no strategies are defined, a single
Strategies that should be applied to
application classes and resourc
es. If no strategies are defined, a single
"application" layer is created out-of-the-box.
"application" layer is created out-of-the-box.
]]>
</xsd:documentation>
]]>
</xsd:documentation>
</xsd:annotation>
</xsd:annotation>
<xsd:choice
maxOccurs=
"unbounded"
>
<xsd:choice
maxOccurs=
"unbounded"
>
<xsd:element
type=
"
classes
LayerContentType"
name=
"layer-content"
maxOccurs=
"unbounded"
<xsd:element
type=
"
application
LayerContentType"
name=
"layer-content"
maxOccurs=
"unbounded"
minOccurs=
"0"
>
minOccurs=
"0"
>
<xsd:annotation>
<xsd:annotation>
<xsd:documentation>
<![CDATA[
<xsd:documentation>
<![CDATA[
Strategy to apply on
class
es.
Strategy to apply on
application classes and resourc
es.
]]>
</xsd:documentation>
]]>
</xsd:documentation>
</xsd:annotation>
</xsd:annotation>
</xsd:element>
</xsd:element>
</xsd:choice>
</xsd:choice>
</xsd:complexType>
</xsd:complexType>
<xsd:complexType
name=
"
classes
LayerContentType"
mixed=
"true"
>
<xsd:complexType
name=
"
application
LayerContentType"
mixed=
"true"
>
<xsd:sequence>
<xsd:sequence>
<xsd:element
type=
"filterType"
name=
"locations"
minOccurs=
"0"
/>
<xsd:element
type=
"filterType"
name=
"locations"
minOccurs=
"0"
/>
</xsd:sequence>
</xsd:sequence>
...
...
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/test/resources/layers.xml
View file @
952e5297
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
</coordinates>
</coordinates>
</layer-content>
</layer-content>
</libraries>
</libraries>
<
classes
>
<
application
>
<layer-content
layer=
"my-resources"
>
<layer-content
layer=
"my-resources"
>
<locations>
<locations>
<include>
META-INF/resources/**
</include>
<include>
META-INF/resources/**
</include>
...
@@ -43,5 +43,5 @@
...
@@ -43,5 +43,5 @@
<include>
**
</include>
<include>
**
</include>
</locations>
</locations>
</layer-content>
</layer-content>
</
classes
>
</
application
>
</layers-configuration>
</layers-configuration>
\ No newline at end of file
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/test/resources/resource-layer-no-filter.xml
View file @
952e5297
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
<layers>
<layers>
<layer>
my-layer
</layer>
<layer>
my-layer
</layer>
</layers>
</layers>
<
classes
>
<
application
>
<layer-content
layer=
"my-layer"
/>
<layer-content
layer=
"my-layer"
/>
</
classes
>
</
application
>
</layers-configuration>
</layers-configuration>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment