Revert Layout changes

This reverts commits:
- 974ec92ad6.
- 537e0c12c2.
- 500a3df6e9.
This commit is contained in:
Phillip Webb
2016-10-31 21:06:37 -07:00
parent 9fc8d61107
commit 97fee46682
13 changed files with 88 additions and 337 deletions

View File

@@ -42,7 +42,8 @@ import org.apache.maven.shared.artifact.filter.collection.ScopeFilter;
import org.springframework.boot.loader.tools.DefaultLaunchScript;
import org.springframework.boot.loader.tools.LaunchScript;
import org.springframework.boot.loader.tools.LayoutType;
import org.springframework.boot.loader.tools.Layout;
import org.springframework.boot.loader.tools.Layouts;
import org.springframework.boot.loader.tools.Libraries;
import org.springframework.boot.loader.tools.Repackager;
@@ -130,7 +131,7 @@ public class RepackageMojo extends AbstractDependencyFilterMojo {
* @since 1.0
*/
@Parameter
private String layout;
private LayoutType layout;
/**
* A list of the libraries that must be unpacked from fat jars in order to run.
@@ -227,7 +228,7 @@ public class RepackageMojo extends AbstractDependencyFilterMojo {
repackager.setMainClass(this.mainClass);
if (this.layout != null) {
getLog().info("Layout: " + this.layout);
repackager.setLayout(LayoutType.layout(this.layout));
repackager.setLayout(this.layout.layout());
}
return repackager;
}
@@ -308,6 +309,53 @@ public class RepackageMojo extends AbstractDependencyFilterMojo {
}
}
/**
* Archive layout types.
*/
public enum LayoutType {
/**
* Jar Layout.
*/
JAR(new Layouts.Jar()),
/**
* War Layout.
*/
WAR(new Layouts.War()),
/**
* Zip Layout.
*/
ZIP(new Layouts.Expanded()),
/**
* Dir Layout.
*/
DIR(new Layouts.Expanded()),
/**
* Module Layout.
*/
MODULE(new Layouts.Module()),
/**
* No Layout.
*/
NONE(new Layouts.None());
private final Layout layout;
public Layout layout() {
return this.layout;
}
LayoutType(Layout layout) {
this.layout = layout;
}
}
private static class LoggingRepackager extends Repackager {
private final Log log;

View File

@@ -1,57 +0,0 @@
-----
Use a custom layout
-----
Dave Syer
-----
2016-10-30
-----
Spring Boot repackages the jar file for this project using a custom
layout defined in the additional jar file, provided as a dependency
to the build plugin:
---
<project>
...
<build>
...
<plugins>
...
<plugin>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<layout>CUSTOM</layout>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.example</groupId>
<artifactId>custom-layout</artifactId>
<version>0.0.1.BUILD-SNAPSHOT</version>
</dependency>
</dependencies>
...
</plugin>
...
</plugins>
...
</build>
...
</project>
---
The layout is provided as an implementation of <<LayoutFactory>>
(from spring-boot-loader-tools) listed in
<<META-INF/spring-factories>> inside the <<custom-layout>> jar.

View File

@@ -48,8 +48,6 @@ Spring Boot Maven Plugin
* {{{./examples/repackage-disable-attach.html}Local repackaged artifact}}
* {{{./examples/custom-layout.html}Custom layout}}
* {{{./examples/exclude-dependency.html}Exclude a dependency}}
* {{{./examples/run-debug.html}Debug the application}}