All Implemented Interfaces:
Comparable<Task>, ContentFilterable, CopyProcessingSpec, CopySourceSpec, CopySpec, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.file.copy.CopySpecSource, org.gradle.api.internal.IConventionAware, org.gradle.api.internal.TaskInternal, ExtensionAware, Task, PatternFilterable, Configurable<Task>, BootArchive

@DisableCachingByDefault(because="Not worth caching") public abstract class BootWar extends War implements BootArchive
A custom War task that produces a Spring Boot executable war.
Since:
2.0.0
Author:
Andy Wilkinson, Phillip Webb, Scott Frederick
  • Constructor Details

    • BootWar

      public BootWar()
      Creates a new BootWar task.
  • Method Details

    • resolvedArtifacts

      public void resolvedArtifacts(Provider<Set<ResolvedArtifactResult>> resolvedArtifacts)
      Description copied from interface: BootArchive
      Registers the given lazily provided resolvedArtifacts. They are used to map from the files in the classpath to their dependency coordinates.
      Specified by:
      resolvedArtifacts in interface BootArchive
      Parameters:
      resolvedArtifacts - the lazily provided resolved artifacts
    • copy

      public void copy()
      Overrides:
      copy in class AbstractCopyTask
    • createCopyAction

      protected org.gradle.api.internal.file.copy.CopyAction createCopyAction()
      Overrides:
      createCopyAction in class Zip
    • requiresUnpack

      public void requiresUnpack(String... patterns)
      Description copied from interface: BootArchive
      Adds Ant-style patterns that identify files that must be unpacked from the archive when it is launched.
      Specified by:
      requiresUnpack in interface BootArchive
      Parameters:
      patterns - the patterns
    • requiresUnpack

      public void requiresUnpack(Spec<FileTreeElement> spec)
      Description copied from interface: BootArchive
      Adds a spec that identifies files that must be unpacked from the archive when it is launched.
      Specified by:
      requiresUnpack in interface BootArchive
      Parameters:
      spec - the spec
    • getLaunchScript

      public LaunchScriptConfiguration getLaunchScript()
      Description copied from interface: BootArchive
      Returns the LaunchScriptConfiguration that will control the script that is prepended to the archive.
      Specified by:
      getLaunchScript in interface BootArchive
      Returns:
      the launch script configuration, or null if the launch script has not been configured.
    • launchScript

      public void launchScript()
      Description copied from interface: BootArchive
      Configures the archive to have a prepended launch script.
      Specified by:
      launchScript in interface BootArchive
    • launchScript

      public void launchScript(Action<LaunchScriptConfiguration> action)
      Description copied from interface: BootArchive
      Configures the archive to have a prepended launch script, customizing its configuration using the given action.
      Specified by:
      launchScript in interface BootArchive
      Parameters:
      action - the action to apply
    • getProvidedClasspath

      @Optional @Classpath public FileCollection getProvidedClasspath()
      Returns the provided classpath, the contents of which will be included in the WEB-INF/lib-provided directory of the war.
      Returns:
      the provided classpath
    • providedClasspath

      public void providedClasspath(Object... classpath)
      Adds files to the provided classpath to include in the WEB-INF/lib-provided directory of the war. The given classpath is evaluated as per Project.files(Object...).
      Parameters:
      classpath - the additions to the classpath
    • setProvidedClasspath

      public void setProvidedClasspath(FileCollection classpath)
      Sets the provided classpath to include in the WEB-INF/lib-provided directory of the war.
      Parameters:
      classpath - the classpath
      Since:
      2.0.7
    • setProvidedClasspath

      public void setProvidedClasspath(Object classpath)
      Sets the provided classpath to include in the WEB-INF/lib-provided directory of the war. The given classpath is evaluated as per Project.files(Object...).
      Parameters:
      classpath - the classpath
      Since:
      2.0.7
    • resolveZipCompression

      protected ZipCompression resolveZipCompression(FileCopyDetails details)
      Return the ZipCompression that should be used when adding the file represented by the given details to the jar. By default, any library is stored and all other files are deflated.
      Parameters:
      details - the file copy details
      Returns:
      the compression to use
    • getLayered

      public LayeredSpec getLayered()
      Returns the spec that describes the layers in a layered jar.
      Returns:
      the spec for the layers
      Since:
      2.5.0
    • layered

      public void layered(Action<LayeredSpec> action)
      Configures the war's layering using the given action.
      Parameters:
      action - the action to apply
      Since:
      2.5.0
    • isLibrary

      protected boolean isLibrary(FileCopyDetails details)
      Return if the FileCopyDetails are for a library. By default any file in WEB-INF/lib or WEB-INF/lib-provided is considered to be a library.
      Parameters:
      details - the file copy details
      Returns:
      true if the details are for a library