@DisableCachingByDefault(because="Not worth caching") public class BootJar extends Jar implements BootArchive
Jar
task that produces a Spring Boot executable jar.Task.Namer
DEFAULT_EXTENSION
ZIP_EXTENSION
TASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE
Constructor and Description |
---|
BootJar()
Creates a new
BootJar task. |
Modifier and Type | Method and Description |
---|---|
CopySpec |
bootInf(Action<CopySpec> action)
Calls the given
action to add content to the BOOT-INF directory of
the jar. |
void |
classpath(Object... classpath)
Adds files to the classpath to include in the archive.
|
void |
copy() |
protected org.gradle.api.internal.file.copy.CopyAction |
createCopyAction() |
CopySpec |
getBootInf()
Returns a
CopySpec that can be used to add content to the BOOT-INF
directory of the jar. |
FileCollection |
getClasspath()
Returns the classpath that will be included in the archive.
|
LaunchScriptConfiguration |
getLaunchScript()
Returns the
LaunchScriptConfiguration that will control the script that is
prepended to the archive. |
LayeredSpec |
getLayered()
Returns the spec that describes the layers in a layered jar.
|
Property<String> |
getMainClass()
Returns the fully-qualified name of the application's main class.
|
protected boolean |
isLibrary(FileCopyDetails details)
Return if the
FileCopyDetails are for a library. |
void |
launchScript()
Configures the archive to have a prepended launch script.
|
void |
launchScript(Action<LaunchScriptConfiguration> action)
Configures the archive to have a prepended launch script, customizing its
configuration using the given
action . |
void |
layered(Action<LayeredSpec> action)
Configures the jar's layering using the given
action . |
void |
requiresUnpack(Spec<FileTreeElement> spec)
Adds a spec that identifies files that must be unpacked from the archive when it is
launched.
|
void |
requiresUnpack(String... patterns)
Adds Ant-style patterns that identify files that must be unpacked from the archive
when it is launched.
|
protected ZipCompression |
resolveZipCompression(FileCopyDetails details)
Return the
ZipCompression that should be used when adding the file
represented by the given details to the jar. |
void |
setClasspath(FileCollection classpath)
Sets the classpath to include in the archive.
|
void |
setClasspath(Object classpath)
Sets the classpath to include in the archive.
|
getManifest, getManifestContentCharset, getMetadataCharset, getMetaInf, manifest, metaInf, metaInf, setManifest, setManifestContentCharset, setMetadataCharset
getCompressor, getEntryCompression, isZip64, setEntryCompression, setZip64
createCopyActionExecuter, getAppendix, getArchiveAppendix, getArchiveBaseName, getArchiveClassifier, getArchiveExtension, getArchiveFile, getArchiveFileName, getArchiveName, getArchivePath, getArchiveVersion, getBaseName, getClassifier, getDestinationDir, getDestinationDirectory, getExtension, getVersion, into, into, into, isPreserveFileTimestamps, isReproducibleFileOrder, setAppendix, setArchiveName, setBaseName, setClassifier, setDestinationDir, setExtension, setPreserveFileTimestamps, setReproducibleFileOrder, setVersion
createRootSpec, eachFile, eachFile, exclude, exclude, exclude, exclude, expand, expand, filesMatching, filesMatching, filesNotMatching, filesNotMatching, filter, filter, filter, filter, from, from, from, getDirectoryFileTreeFactory, getDirMode, getDocumentationRegistry, getDuplicatesStrategy, getExcludes, getFileLookup, getFileMode, getFileResolver, getFileSystem, getFilteringCharset, getIncludeEmptyDirs, getIncludes, getInstantiator, getMainSpec, getObjectFactory, getRootSpec, getSource, include, include, include, include, isCaseSensitive, rename, rename, rename, rename, setCaseSensitive, setDirMode, setDuplicatesStrategy, setExcludes, setFileMode, setFilteringCharset, setIncludeEmptyDirs, setIncludes, with
conventionMapping, conventionMapping, getConventionMapping
compareTo, configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, finalizedBy, getActions, getAnt, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOutputs, getPath, getProject, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, hasProperty, mustRunAfter, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesService
appendParallelSafeAction, doNotTrackState, getAsDynamicObject, getConvention, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, setImpliesSubProjects
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, doNotTrackState, finalizedBy, getActions, getAnt, getConvention, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getFinalizedBy, getGroup, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOutputs, getPath, getProject, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, hasProperty, mustRunAfter, notCompatibleWithConfigurationCache, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesService
compareTo
getExtensions
public void copy()
copy
in class AbstractCopyTask
protected org.gradle.api.internal.file.copy.CopyAction createCopyAction()
createCopyAction
in class Zip
public Property<String> getMainClass()
BootArchive
getMainClass
in interface BootArchive
public void requiresUnpack(String... patterns)
BootArchive
requiresUnpack
in interface BootArchive
patterns
- the patternspublic void requiresUnpack(Spec<FileTreeElement> spec)
BootArchive
requiresUnpack
in interface BootArchive
spec
- the specpublic LaunchScriptConfiguration getLaunchScript()
BootArchive
LaunchScriptConfiguration
that will control the script that is
prepended to the archive.getLaunchScript
in interface BootArchive
null
if the launch script has
not been configured.public void launchScript()
BootArchive
launchScript
in interface BootArchive
public void launchScript(Action<LaunchScriptConfiguration> action)
BootArchive
action
.launchScript
in interface BootArchive
action
- the action to applypublic LayeredSpec getLayered()
public void layered(Action<LayeredSpec> action)
action
.action
- the action to applypublic FileCollection getClasspath()
BootArchive
getClasspath
in interface BootArchive
public void classpath(Object... classpath)
BootArchive
classpath
is evaluated as per Project.files(Object...)
.classpath
in interface BootArchive
classpath
- the additions to the classpathpublic void setClasspath(Object classpath)
BootArchive
classpath
is
evaluated as per Project.files(Object...)
.setClasspath
in interface BootArchive
classpath
- the classpathpublic void setClasspath(FileCollection classpath)
BootArchive
setClasspath
in interface BootArchive
classpath
- the classpath@Internal public CopySpec getBootInf()
CopySpec
that can be used to add content to the BOOT-INF
directory of the jar.CopySpec
for BOOT-INF
public CopySpec bootInf(Action<CopySpec> action)
action
to add content to the BOOT-INF
directory of
the jar.action
- the Action
to callCopySpec
for BOOT-INF
that was passed to the
Action
protected ZipCompression resolveZipCompression(FileCopyDetails details)
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
.details
- the file copy detailsprotected boolean isLibrary(FileCopyDetails details)
FileCopyDetails
are for a library. By default any file in
BOOT-INF/lib
is considered to be a library.details
- the file copy detailstrue
if the details are for a library