Merge branch '2.0.x' into 2.1.x

This commit is contained in:
Andy Wilkinson
2019-04-02 10:27:34 +01:00
6 changed files with 42 additions and 23 deletions

View File

@@ -79,10 +79,20 @@ class BootArchiveSupport {
configureExclusions();
}
void configureManifest(Jar jar, String mainClassName) {
void configureManifest(Jar jar, String mainClassName, String springBootClasses,
String springBootLib) {
Attributes attributes = jar.getManifest().getAttributes();
attributes.putIfAbsent("Main-Class", this.loaderMainClass);
attributes.putIfAbsent("Start-Class", mainClassName);
attributes.computeIfAbsent("Spring-Boot-Version",
(key) -> determineSpringBootVersion());
attributes.putIfAbsent("Spring-Boot-Classes", springBootClasses);
attributes.putIfAbsent("Spring-Boot-Lib", springBootLib);
}
private String determineSpringBootVersion() {
String implementationVersion = getClass().getPackage().getImplementationVersion();
return (implementationVersion != null) ? implementationVersion : "unknown";
}
CopyAction createCopyAction(Jar jar) {

View File

@@ -74,7 +74,8 @@ public class BootJar extends Jar implements BootArchive {
@Override
public void copy() {
this.support.configureManifest(this, getMainClassName());
this.support.configureManifest(this, getMainClassName(), "BOOT-INF/classes/",
"BOOT-INF/lib/");
super.copy();
}

View File

@@ -68,7 +68,8 @@ public class BootWar extends War implements BootArchive {
@Override
public void copy() {
this.support.configureManifest(this, getMainClassName());
this.support.configureManifest(this, getMainClassName(), "WEB-INF/classes/",
"WEB-INF/lib/");
super.copy();
}