ApplicationSpec
, 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>
@CacheableTask public abstract class ApplicationJar extends Jar implements ApplicationSpec
Task.Namer
Modifier and Type | Field | Description |
---|---|---|
static String |
APPLICATION_DIRECTORY_NAME |
Name of the build directory where the application JARs will be generated by default.
|
static String |
DEPENDENCY_DIRECTORY_NAME |
Name of the subdirectory where the dependencies will be placed by default.
|
DEFAULT_EXTENSION
ZIP_EXTENSION
TASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE
Constructor | Description |
---|---|
ApplicationJar() |
Creates an
ApplicationJar task. |
Modifier and Type | Method | Description |
---|---|---|
CopySpec |
applicationCopySpec() |
Creates a new
CopySpec that can be used to copy the application JAR generated by this task, along with
its dependency artifact files, to an organized directory structure that allows the application to be run. |
void |
finalizeProperties() |
Finalizes the properties of this task.
|
getManifest, getManifestContentCharset, getMetadataCharset, getMetaInf, manifest, metaInf, metaInf, setManifest, setManifestContentCharset, setMetadataCharset
getEntryCompression, isZip64, setEntryCompression, setZip64
getArchiveAppendix, getArchiveBaseName, getArchiveClassifier, getArchiveExtension, getArchiveFile, getArchiveFileName, getArchivePath, getArchiveVersion, getDestinationDirectory, into, into, into, isPreserveFileTimestamps, isReproducibleFileOrder, setPreserveFileTimestamps, setReproducibleFileOrder
dirPermissions, eachFile, eachFile, exclude, exclude, exclude, exclude, expand, expand, filePermissions, filesMatching, filesMatching, filesNotMatching, filesNotMatching, filter, filter, filter, filter, from, from, from, getDirMode, getDirPermissions, getDuplicatesStrategy, getExcludes, getFileMode, getFilePermissions, getFilteringCharset, getIncludeEmptyDirs, getIncludes, 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, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesService
acceptServiceReferences, appendParallelSafeAction, doNotTrackState, getAsDynamicObject, getConvention, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, setImpliesSubProjects
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
fromSourceSet, fromSourceSet, getDependencies, getDependencyDirectoryName, getMainClass, getProject, getRawJar, locateDependencies, locateDependencies, locateRawJar, locateRawJar
doNotTrackState, getConvention, notCompatibleWithConfigurationCache
public static final String APPLICATION_DIRECTORY_NAME
public static final String DEPENDENCY_DIRECTORY_NAME
@Inject public ApplicationJar()
ApplicationJar
task.@Nonnull public CopySpec applicationCopySpec()
Creates a new CopySpec
that can be used to copy the application JAR generated by this task, along with
its dependency artifact files, to an organized directory structure that allows the application to be run.
The application JAR will be copied to the destination directory, while dependency artifact files will end up
in a subdirectory whose name can be set through the dependencyDirectoryName
property. Within that directory, the relative path of dependency artifact files is specified by
Dependency.relativePath
.
Note that in order to avoid resolving the dependencies
configuration too early, the
destination paths of dependency artifact files are generated lazily using an eachFile
action. Since these actions are executed in the order they were registered in, if a custom one gets added to the
CopySpec
returned by this method, it will have access to the final destination paths. However, if the
returned CopySpec
itself gets added to another one as a child spec, and the
parent spec has an eachFile
action of its own, that will not see the final
destination paths, because Gradle executes actions registered on the parent spec before those on the child.
As a general rule, avoid changing the destination paths or excluding files, because doing so may result in
missing dependencies at runtime, causing the application to throw exceptions such as NoClassDefFoundError
or ClassNotFoundException
.
CopySpec
.ApplicationSpec.getDependencyDirectoryName()
public void finalizeProperties()
IllegalStateException
.Property.finalizeValue()