Skip to content

Commit cd51240

Browse files
committed
Deprecate support for module layout
Closes gh-8008
1 parent a081c96 commit cd51240

File tree

5 files changed

+25
-9
lines changed

5 files changed

+25
-9
lines changed

spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/SpringBootPluginExtension.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2016 the original author or authors.
2+
* Copyright 2012-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -304,7 +304,7 @@ enum LayoutType {
304304

305305
DIR(new Layouts.Expanded()),
306306

307-
MODULE(new Layouts.Module()),
307+
@SuppressWarnings("deprecation") MODULE(new Layouts.Module()),
308308

309309
NONE(new Layouts.None());
310310

spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/repackage/RepackageTask.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2016 the original author or authors.
2+
* Copyright 2012-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -33,6 +33,8 @@
3333
import org.springframework.boot.gradle.SpringBootPluginExtension;
3434
import org.springframework.boot.loader.tools.DefaultLaunchScript;
3535
import org.springframework.boot.loader.tools.LaunchScript;
36+
import org.springframework.boot.loader.tools.Layout;
37+
import org.springframework.boot.loader.tools.Layouts;
3638
import org.springframework.boot.loader.tools.Repackager;
3739
import org.springframework.boot.loader.tools.Repackager.MainClassTimeoutWarningListener;
3840
import org.springframework.util.FileCopyUtils;
@@ -207,6 +209,7 @@ private boolean isTaskMatch(Jar task, Object withJarTask) {
207209
return task.equals(withJarTask) || task.getName().equals(withJarTask);
208210
}
209211

212+
@SuppressWarnings("deprecation")
210213
private void repackage(File file) {
211214
File outputFile = RepackageTask.this.outputFile;
212215
if (outputFile != null && !file.equals(outputFile)) {
@@ -218,8 +221,13 @@ private void repackage(File file) {
218221
repackager.addMainClassTimeoutWarningListener(
219222
new LoggingMainClassTimeoutWarningListener());
220223
setMainClass(repackager);
221-
if (this.extension.convertLayout() != null) {
222-
repackager.setLayout(this.extension.convertLayout());
224+
Layout layout = this.extension.convertLayout();
225+
if (layout != null) {
226+
if (layout instanceof Layouts.Module) {
227+
getLogger().warn("Module layout is deprecated. Please use a custom"
228+
+ " LayoutFactory instead.");
229+
}
230+
repackager.setLayout(layout);
223231
}
224232
repackager.setBackupSource(this.extension.isBackupSource());
225233
try {

spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layouts.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2016 the original author or authors.
2+
* Copyright 2012-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -158,7 +158,9 @@ public boolean isExecutable() {
158158

159159
/**
160160
* Module layout (designed to be used as a "plug-in").
161+
* @deprecated since 1.5 in favour of a custom {@link LayoutFactory}
161162
*/
163+
@Deprecated
162164
public static class Module implements Layout {
163165

164166
private static final Set<LibraryScope> LIB_DESTINATION_SCOPES = new HashSet<LibraryScope>(

spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/LayoutsTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2016 the original author or authors.
2+
* Copyright 2012-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -87,6 +87,7 @@ public void warLayout() throws Exception {
8787
}
8888

8989
@Test
90+
@SuppressWarnings("deprecation")
9091
public void moduleLayout() throws Exception {
9192
Layout layout = new Layouts.Module();
9293
assertThat(layout.getLibraryDestination("lib.jar", LibraryScope.COMPILE))

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2016 the original author or authors.
2+
* Copyright 2012-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -236,6 +236,10 @@ private Repackager getRepackager(File source) {
236236
repackager.setMainClass(this.mainClass);
237237
if (this.layout != null) {
238238
getLog().info("Layout: " + this.layout);
239+
if (this.layout == LayoutType.MODULE) {
240+
getLog().warn("Module layout is deprecated. Please use a custom"
241+
+ " LayoutFactory instead.");
242+
}
239243
repackager.setLayout(this.layout.layout());
240244
}
241245
return repackager;
@@ -344,8 +348,9 @@ public enum LayoutType {
344348

345349
/**
346350
* Module Layout.
351+
* @deprecated since 1.5 in favour of a custom {@link LayoutFactory}
347352
*/
348-
MODULE(new Layouts.Module()),
353+
@Deprecated MODULE(new Layouts.Module()),
349354

350355
/**
351356
* No Layout.

0 commit comments

Comments
 (0)