Skip to content

Commit 952e529

Browse files
committed
Rename "classes" to "application" in custom layer configuration
Closes gh-20539
1 parent 29c89f3 commit 952e529

File tree

12 files changed

+27
-26
lines changed

12 files changed

+27
-26
lines changed

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-jar-layered-custom.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ bootJar {
2323
}
2424
}
2525
}
26-
classes {
26+
application {
2727
layerContent("resources") {
2828
locations {
2929
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ tasks.getByName<BootJar>("bootJar") {
2121
}
2222
}
2323
}
24-
classes {
24+
application {
2525
layerContent("resources") {
2626
locations {
2727
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ private void applyLayers() {
214214
else {
215215
List<Layer> customLayers = this.layerConfiguration.getLayersOrder().stream().map(Layer::new)
216216
.collect(Collectors.toList());
217-
this.layers = new CustomLayers(customLayers, this.layerConfiguration.getClasses(),
217+
this.layers = new CustomLayers(customLayers, this.layerConfiguration.getApplication(),
218218
this.layerConfiguration.getLibraries());
219219
}
220220

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/LayerConfiguration.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,16 @@ public void layersOrder(List<String> layers) {
7979
}
8080

8181
@Input
82-
public List<ResourceStrategy> getClasses() {
82+
public List<ResourceStrategy> getApplication() {
8383
return this.resourceStrategies;
8484
}
8585

86-
public void classes(ResourceStrategy... resourceStrategies) {
86+
public void application(ResourceStrategy... resourceStrategies) {
8787
assertLayersOrderConfigured();
8888
this.resourceStrategies = Arrays.asList(resourceStrategies);
8989
}
9090

91-
public void classes(Action<LayerConfiguration> config) {
91+
public void application(Action<LayerConfiguration> config) {
9292
assertLayersOrderConfigured();
9393
this.strategySpec = StrategySpec.forResources();
9494
config.execute(this);
@@ -135,7 +135,8 @@ public void coordinates(Action<LayerConfiguration> config) {
135135
}
136136

137137
public void locations(Action<LayerConfiguration> config) {
138-
Assert.state(this.strategySpec.isResourcesStrategy(), "The 'locations' filter must be used only with classes");
138+
Assert.state(this.strategySpec.isResourcesStrategy(),
139+
"The 'locations' filter must be used only with application");
139140
this.strategySpec.newFilter();
140141
config.execute(this);
141142
this.strategySpec

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/BootJarTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ void whenJarIsLayeredWithCustomStrategiesThenContentsAreMovedToLayerDirectories(
126126
configuration.libraries(createLibraryStrategy("my-snapshot-deps", "com.example:*:*.SNAPSHOT"),
127127
createLibraryStrategy("my-internal-deps", "com.example:*:*"),
128128
createLibraryStrategy("my-deps", "*:*"));
129-
configuration.classes(createResourceStrategy("resources", "static/**"),
129+
configuration.application(createResourceStrategy("resources", "static/**"),
130130
createResourceStrategy("application", "**"));
131131
});
132132
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ bootJar {
1212
layerContent("commons-dependencies") { coordinates { include "org.apache.commons:*" } }
1313
layerContent("dependencies") { coordinates { include "*:*" } }
1414
}
15-
classes {
15+
application {
1616
layerContent("static") {
1717
locations {
1818
include "META-INF/resources/**", "resources/**"

spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/packaging.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ The following example shows what the implicit layer configuration described abov
164164
</coordinates>
165165
</layer-content>
166166
</libraries>
167-
<classes>
167+
<application>
168168
<layer-content layer="resources">
169169
<locations>
170170
<include>META-INF/resources/**</include>
@@ -178,7 +178,7 @@ The following example shows what the implicit layer configuration described abov
178178
<include>**</include>
179179
</locations>
180180
</layer-content>
181-
</classes>
181+
</application>
182182
</layers-configuration>
183183
----
184184

@@ -589,9 +589,9 @@ This allows to reuse the cache for external dependencies when an internal depend
589589
</coordinates>
590590
</layer-content>
591591
</libraries>
592-
<classes>
592+
<application>
593593
...
594-
</classes>
594+
</application>
595595
</layers-configuration>
596596
----
597597

spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/projects/jar-layered-custom/jar/src/layers.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
</coordinates>
2121
</layer-content>
2222
</libraries>
23-
<classes>
23+
<application>
2424
<layer-content layer="configuration">
2525
<locations>
2626
<include>**/application*.*</include>
@@ -31,5 +31,5 @@
3131
<include>**</include>
3232
</locations>
3333
</layer-content>
34-
</classes>
34+
</application>
3535
</layers-configuration>

spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/CustomLayersProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ private void processNode(List<Layer> layers, List<LibraryStrategy> libraryStrate
7171
(StrategyFactory<LibraryFilter, LibraryStrategy>) FilteredLibraryStrategy::new,
7272
CoordinateFilter::new, "coordinates"::equals));
7373
}
74-
if ("classes".equals(nodeName)) {
74+
if ("application".equals(nodeName)) {
7575
resourceStrategies.addAll(getStrategies(contents,
7676
(StrategyFactory<ResourceFilter, ResourceStrategy>) FilteredResourceStrategy::new,
7777
LocationFilter::new, "locations"::equals));

spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/xsd/layers-configuration.xsd

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<xsd:sequence>
99
<xsd:element type="layersType" name="layers"/>
1010
<xsd:element type="librariesType" name="libraries" minOccurs="0"/>
11-
<xsd:element type="classesType" name="classes" minOccurs="0"/>
11+
<xsd:element type="applicationType" name="application" minOccurs="0"/>
1212
</xsd:sequence>
1313
</xsd:complexType>
1414
<xsd:complexType name="layersType">
@@ -48,25 +48,25 @@
4848
</xsd:sequence>
4949
<xsd:attribute type="xsd:string" name="layer" use="required"/>
5050
</xsd:complexType>
51-
<xsd:complexType name="classesType">
51+
<xsd:complexType name="applicationType">
5252
<xsd:annotation>
5353
<xsd:documentation><![CDATA[
54-
Strategies that should be applied to classes. If no strategies are defined, a single
54+
Strategies that should be applied to application classes and resources. If no strategies are defined, a single
5555
"application" layer is created out-of-the-box.
5656
]]></xsd:documentation>
5757
</xsd:annotation>
5858
<xsd:choice maxOccurs="unbounded">
59-
<xsd:element type="classesLayerContentType" name="layer-content" maxOccurs="unbounded"
59+
<xsd:element type="applicationLayerContentType" name="layer-content" maxOccurs="unbounded"
6060
minOccurs="0">
6161
<xsd:annotation>
6262
<xsd:documentation><![CDATA[
63-
Strategy to apply on classes.
63+
Strategy to apply on application classes and resources.
6464
]]></xsd:documentation>
6565
</xsd:annotation>
6666
</xsd:element>
6767
</xsd:choice>
6868
</xsd:complexType>
69-
<xsd:complexType name="classesLayerContentType" mixed="true">
69+
<xsd:complexType name="applicationLayerContentType" mixed="true">
7070
<xsd:sequence>
7171
<xsd:element type="filterType" name="locations" minOccurs="0"/>
7272
</xsd:sequence>

spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/test/resources/layers.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
</coordinates>
2828
</layer-content>
2929
</libraries>
30-
<classes>
30+
<application>
3131
<layer-content layer="my-resources">
3232
<locations>
3333
<include>META-INF/resources/**</include>
@@ -43,5 +43,5 @@
4343
<include>**</include>
4444
</locations>
4545
</layer-content>
46-
</classes>
46+
</application>
4747
</layers-configuration>

spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/test/resources/resource-layer-no-filter.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<layers>
66
<layer>my-layer</layer>
77
</layers>
8-
<classes>
8+
<application>
99
<layer-content layer="my-layer"/>
10-
</classes>
10+
</application>
1111
</layers-configuration>

0 commit comments

Comments
 (0)