|
|
|
@ -40,6 +40,8 @@ public class BootJar extends Jar implements BootArchive {
|
|
|
|
|
private final BootArchiveSupport support = new BootArchiveSupport(
|
|
|
|
|
"org.springframework.boot.loader.JarLauncher", this::resolveZipCompression);
|
|
|
|
|
|
|
|
|
|
private final CopySpec bootInf;
|
|
|
|
|
|
|
|
|
|
private FileCollection classpath;
|
|
|
|
|
|
|
|
|
|
private String mainClassName;
|
|
|
|
@ -48,8 +50,10 @@ public class BootJar extends Jar implements BootArchive {
|
|
|
|
|
* Creates a new {@code BootJar} task.
|
|
|
|
|
*/
|
|
|
|
|
public BootJar() {
|
|
|
|
|
into("BOOT-INF/classes", classpathFiles(File::isDirectory));
|
|
|
|
|
into("BOOT-INF/lib", classpathFiles(File::isFile));
|
|
|
|
|
this.bootInf = getProject().copySpec().into("BOOT-INF");
|
|
|
|
|
getMainSpec().with(this.bootInf);
|
|
|
|
|
this.bootInf.into("classes", classpathFiles(File::isDirectory));
|
|
|
|
|
this.bootInf.into("lib", classpathFiles(File::isFile));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Action<CopySpec> classpathFiles(Spec<File> filter) {
|
|
|
|
@ -128,6 +132,32 @@ public class BootJar extends Jar implements BootArchive {
|
|
|
|
|
this.support.setExcludeDevtools(excludeDevtools);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a {@code CopySpec} that can be used to add content to the {@code BOOT-INF}
|
|
|
|
|
* directory of the jar.
|
|
|
|
|
* @return a {@code CopySpec} for {@code BOOT-INF}
|
|
|
|
|
* @since 2.0.3
|
|
|
|
|
*/
|
|
|
|
|
public CopySpec getBootInf() {
|
|
|
|
|
CopySpec child = getProject().copySpec();
|
|
|
|
|
this.bootInf.with(child);
|
|
|
|
|
return child;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Calls the given {@code action} to add content to the {@code BOOT-INF} directory of
|
|
|
|
|
* the jar.
|
|
|
|
|
* @param action the {@code Action} to call
|
|
|
|
|
* @return the {@code CopySpec} for {@code BOOT-INF} that was passed to the
|
|
|
|
|
* {@code Action}
|
|
|
|
|
* @since 2.0.3
|
|
|
|
|
*/
|
|
|
|
|
public CopySpec bootInf(Action<CopySpec> action) {
|
|
|
|
|
CopySpec bootInf = getBootInf();
|
|
|
|
|
action.execute(bootInf);
|
|
|
|
|
return bootInf;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns the {@link ZipCompression} that should be used when adding the file
|
|
|
|
|
* represented by the given {@code details} to the jar.
|
|
|
|
|