Remove support for module layout

Closes gh-8107
pull/8103/merge
Andy Wilkinson 8 years ago
parent 3ce6d8e5b5
commit bdf903896f

@ -304,8 +304,6 @@ public class SpringBootPluginExtension {
DIR(new Layouts.Expanded()),
@SuppressWarnings("deprecation") MODULE(new Layouts.Module()),
NONE(new Layouts.None());
Layout layout;

@ -34,7 +34,6 @@ import org.springframework.boot.gradle.SpringBootPluginExtension;
import org.springframework.boot.loader.tools.DefaultLaunchScript;
import org.springframework.boot.loader.tools.LaunchScript;
import org.springframework.boot.loader.tools.Layout;
import org.springframework.boot.loader.tools.Layouts;
import org.springframework.boot.loader.tools.Repackager;
import org.springframework.boot.loader.tools.Repackager.MainClassTimeoutWarningListener;
import org.springframework.util.FileCopyUtils;
@ -209,7 +208,6 @@ public class RepackageTask extends DefaultTask {
return task.equals(withJarTask) || task.getName().equals(withJarTask);
}
@SuppressWarnings("deprecation")
private void repackage(File file) {
File outputFile = RepackageTask.this.outputFile;
if (outputFile != null && !file.equals(outputFile)) {
@ -223,10 +221,6 @@ public class RepackageTask extends DefaultTask {
setMainClass(repackager);
Layout layout = this.extension.convertLayout();
if (layout != null) {
if (layout instanceof Layouts.Module) {
getLogger().warn("Module layout is deprecated. Please use a custom"
+ " LayoutFactory instead.");
}
repackager.setLayout(layout);
}
repackager.setBackupSource(this.extension.isBackupSource());

@ -17,12 +17,9 @@
package org.springframework.boot.loader.tools;
import java.io.File;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
/**
* Common {@link Layout}s.
@ -156,40 +153,4 @@ public final class Layouts {
}
/**
* Module layout (designed to be used as a "plug-in").
* @deprecated since 1.5 in favour of a custom {@link LayoutFactory}
*/
@Deprecated
public static class Module implements Layout {
private static final Set<LibraryScope> LIB_DESTINATION_SCOPES = new HashSet<LibraryScope>(
Arrays.asList(LibraryScope.COMPILE, LibraryScope.RUNTIME,
LibraryScope.CUSTOM));
@Override
public String getLauncherClassName() {
return null;
}
@Override
public String getLibraryDestination(String libraryName, LibraryScope scope) {
if (LIB_DESTINATION_SCOPES.contains(scope)) {
return "lib/";
}
return null;
}
@Override
public String getClassesLocation() {
return "";
}
@Override
public boolean isExecutable() {
return false;
}
}
}

@ -86,18 +86,4 @@ public class LayoutsTests {
.isEqualTo("WEB-INF/lib/");
}
@Test
@SuppressWarnings("deprecation")
public void moduleLayout() throws Exception {
Layout layout = new Layouts.Module();
assertThat(layout.getLibraryDestination("lib.jar", LibraryScope.COMPILE))
.isEqualTo("lib/");
assertThat(layout.getLibraryDestination("lib.jar", LibraryScope.PROVIDED))
.isNull();
assertThat(layout.getLibraryDestination("lib.jar", LibraryScope.RUNTIME))
.isEqualTo("lib/");
assertThat(layout.getLibraryDestination("lib.jar", LibraryScope.CUSTOM))
.isEqualTo("lib/");
}
}

@ -1,48 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.boot.maven.it</groupId>
<artifactId>module</artifactId>
<version>0.0.1.BUILD-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>@project.groupId@</groupId>
<artifactId>@project.artifactId@</artifactId>
<version>@project.version@</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<layout>MODULE</layout>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>@spring.version@</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>@servlet-api.version@</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

@ -1,21 +0,0 @@
/*
* Copyright 2012-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.test;
public class SampleModule {
}

@ -1,5 +0,0 @@
import java.io.*;
import org.springframework.boot.maven.*;
Verify.verifyModule(new File( basedir, "target/module-0.0.1.BUILD-SNAPSHOT.jar" ));

@ -236,10 +236,6 @@ public class RepackageMojo extends AbstractDependencyFilterMojo {
repackager.setMainClass(this.mainClass);
if (this.layout != null) {
getLog().info("Layout: " + this.layout);
if (this.layout == LayoutType.MODULE) {
getLog().warn("Module layout is deprecated. Please use a custom"
+ " LayoutFactory instead.");
}
repackager.setLayout(this.layout.layout());
}
return repackager;
@ -346,12 +342,6 @@ public class RepackageMojo extends AbstractDependencyFilterMojo {
*/
DIR(new Layouts.Expanded()),
/**
* Module Layout.
* @deprecated since 1.5 in favour of a custom {@link LayoutFactory}
*/
@Deprecated MODULE(new Layouts.Module()),
/**
* No Layout.
*/

Loading…
Cancel
Save