Class BootJar
java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
org.gradle.api.internal.ConventionTask
org.gradle.api.tasks.AbstractCopyTask
org.gradle.api.tasks.bundling.AbstractArchiveTask
org.gradle.api.tasks.bundling.Zip
org.gradle.jvm.tasks.Jar
org.gradle.api.tasks.bundling.Jar
org.springframework.boot.gradle.tasks.bundling.BootJar
- 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 BootJar
extends Jar
implements BootArchive
A custom
Jar task that produces a Spring Boot executable jar.- Since:
- 2.0.0
- Author:
- Andy Wilkinson, Madhura Bhave, Scott Frederick, Phillip Webb
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.gradle.api.Task
Task.Namer -
Field Summary
Fields inherited from class org.gradle.jvm.tasks.Jar
DEFAULT_EXTENSIONFields inherited from class org.gradle.api.tasks.bundling.Zip
ZIP_EXTENSIONFields inherited from interface org.gradle.api.Task
TASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCalls the givenactionto add content to theBOOT-INFdirectory of the jar.voidAdds files to the classpath to include in the archive.voidcopy()protected org.gradle.api.internal.file.copy.CopyActionReturns aCopySpecthat can be used to add content to theBOOT-INFdirectory of the jar.Returns the classpath that will be included in the archive.Returns theLaunchScriptConfigurationthat will control the script that is prepended to the archive.Returns the spec that describes the layers in a layered jar.protected booleanisLibrary(FileCopyDetails details) Return if theFileCopyDetailsare for a library.voidConfigures the archive to have a prepended launch script.voidlaunchScript(Action<LaunchScriptConfiguration> action) Configures the archive to have a prepended launch script, customizing its configuration using the givenaction.voidlayered(Action<LayeredSpec> action) Configures the jar's layering using the givenaction.voidrequiresUnpack(String... patterns) Adds Ant-style patterns that identify files that must be unpacked from the archive when it is launched.voidrequiresUnpack(Spec<FileTreeElement> spec) Adds a spec that identifies files that must be unpacked from the archive when it is launched.voidresolvedArtifacts(Provider<Set<ResolvedArtifactResult>> resolvedArtifacts) Registers the given lazily providedresolvedArtifacts.protected ZipCompressionresolveZipCompression(FileCopyDetails details) Return theZipCompressionthat should be used when adding the file represented by the givendetailsto the jar.voidsetClasspath(Object classpath) Sets the classpath to include in the archive.voidsetClasspath(FileCollection classpath) Sets the classpath to include in the archive.Methods inherited from class org.gradle.jvm.tasks.Jar
getManifest, getManifestContentCharset, getMetadataCharset, getMetaInf, manifest, metaInf, metaInf, setManifest, setManifestContentCharset, setMetadataCharsetMethods inherited from class org.gradle.api.tasks.bundling.Zip
getCompressor, getEntryCompression, isZip64, setEntryCompression, setZip64Methods inherited from class org.gradle.api.tasks.bundling.AbstractArchiveTask
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, setVersionMethods inherited from class org.gradle.api.tasks.AbstractCopyTask
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, withMethods inherited from class org.gradle.api.internal.ConventionTask
conventionMapping, conventionMapping, getConventionMappingMethods inherited from class org.gradle.api.DefaultTask
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, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesServiceMethods inherited from class org.gradle.api.internal.AbstractTask
appendParallelSafeAction, doNotTrackState, getAsDynamicObject, getConvention, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, setImpliesSubProjectsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.boot.gradle.tasks.bundling.BootArchive
getLoaderImplementation, getMainClass, getTargetJavaVersionMethods inherited from interface java.lang.Comparable
compareToMethods inherited from interface org.gradle.api.plugins.ExtensionAware
getExtensionsMethods inherited from interface org.gradle.api.Task
configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, doNotTrackState, finalizedBy, getActions, getAnt, getConvention, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getFinalizedBy, getGroup, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getPath, getProject, getShouldRunAfter, getTaskDependencies, getTemporaryDir, getTimeout, hasProperty, mustRunAfter, notCompatibleWithConfigurationCache, onlyIf, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesService
-
Constructor Details
-
BootJar
public BootJar()Creates a newBootJartask.
-
-
Method Details
-
resolvedArtifacts
Description copied from interface:BootArchiveRegisters the given lazily providedresolvedArtifacts. They are used to map from the files in theclasspathto their dependency coordinates.- Specified by:
resolvedArtifactsin interfaceBootArchive- Parameters:
resolvedArtifacts- the lazily provided resolved artifacts
-
copy
public void copy()- Overrides:
copyin classAbstractCopyTask
-
createCopyAction
protected org.gradle.api.internal.file.copy.CopyAction createCopyAction()- Overrides:
createCopyActionin classZip
-
requiresUnpack
Description copied from interface:BootArchiveAdds Ant-style patterns that identify files that must be unpacked from the archive when it is launched.- Specified by:
requiresUnpackin interfaceBootArchive- Parameters:
patterns- the patterns
-
requiresUnpack
Description copied from interface:BootArchiveAdds a spec that identifies files that must be unpacked from the archive when it is launched.- Specified by:
requiresUnpackin interfaceBootArchive- Parameters:
spec- the spec
-
getLaunchScript
Description copied from interface:BootArchiveReturns theLaunchScriptConfigurationthat will control the script that is prepended to the archive.- Specified by:
getLaunchScriptin interfaceBootArchive- Returns:
- the launch script configuration, or
nullif the launch script has not been configured.
-
launchScript
public void launchScript()Description copied from interface:BootArchiveConfigures the archive to have a prepended launch script.- Specified by:
launchScriptin interfaceBootArchive
-
launchScript
Description copied from interface:BootArchiveConfigures the archive to have a prepended launch script, customizing its configuration using the givenaction.- Specified by:
launchScriptin interfaceBootArchive- Parameters:
action- the action to apply
-
getLayered
Returns the spec that describes the layers in a layered jar.- Returns:
- the spec for the layers
- Since:
- 2.3.0
-
layered
Configures the jar's layering using the givenaction.- Parameters:
action- the action to apply- Since:
- 2.3.0
-
getClasspath
Description copied from interface:BootArchiveReturns the classpath that will be included in the archive.- Specified by:
getClasspathin interfaceBootArchive- Returns:
- the classpath
-
classpath
Description copied from interface:BootArchiveAdds files to the classpath to include in the archive. The givenclasspathis evaluated as perProject.files(Object...).- Specified by:
classpathin interfaceBootArchive- Parameters:
classpath- the additions to the classpath
-
setClasspath
Description copied from interface:BootArchiveSets the classpath to include in the archive. The givenclasspathis evaluated as perProject.files(Object...).- Specified by:
setClasspathin interfaceBootArchive- Parameters:
classpath- the classpath
-
setClasspath
Description copied from interface:BootArchiveSets the classpath to include in the archive.- Specified by:
setClasspathin interfaceBootArchive- Parameters:
classpath- the classpath
-
getBootInf
Returns aCopySpecthat can be used to add content to theBOOT-INFdirectory of the jar.- Returns:
- a
CopySpecforBOOT-INF - Since:
- 2.0.3
-
bootInf
Calls the givenactionto add content to theBOOT-INFdirectory of the jar.- Parameters:
action- theActionto call- Returns:
- the
CopySpecforBOOT-INFthat was passed to theAction - Since:
- 2.0.3
-
resolveZipCompression
Return theZipCompressionthat should be used when adding the file represented by the givendetailsto the jar. By default, anylibraryisstoredand all other files aredeflated.- Parameters:
details- the file copy details- Returns:
- the compression to use
-
isLibrary
Return if theFileCopyDetailsare for a library. By default any file inBOOT-INF/libis considered to be a library.- Parameters:
details- the file copy details- Returns:
trueif the details are for a library- Since:
- 2.3.0
-