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
com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
All Implemented Interfaces:
Comparable<org.gradle.api.Task>, org.gradle.api.file.ContentFilterable, org.gradle.api.file.CopyProcessingSpec, org.gradle.api.file.CopySourceSpec, org.gradle.api.file.CopySpec, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.file.copy.CopySpecSource, org.gradle.api.internal.IConventionAware, org.gradle.api.internal.TaskInternal, org.gradle.api.Named, org.gradle.api.plugins.ExtensionAware, org.gradle.api.Task, org.gradle.api.tasks.util.PatternFilterable, org.gradle.util.Configurable<org.gradle.api.Task>

@CacheableTask public class ShadowJar extends org.gradle.api.tasks.bundling.Jar
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.gradle.api.Task

    org.gradle.api.Task.Namer
  • Field Summary

    Fields inherited from class org.gradle.jvm.tasks.Jar

    DEFAULT_EXTENSION

    Fields inherited from class org.gradle.api.tasks.bundling.Zip

    ZIP_EXTENSION

    Fields 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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    append(String resourcePath)
    Syntax sugar for merging service files in JARs
    protected void
     
    protected @NotNull org.gradle.api.internal.file.copy.CopyAction
     
    dependencies(org.gradle.api.Action<com.github.jengelman.gradle.plugins.shadow.internal.DependencyFilter> c)
    Configure inclusion/exclusion of module and project dependencies into uber jar.
    List<org.gradle.api.file.FileCollection>
     
    com.github.jengelman.gradle.plugins.shadow.internal.DependencyFilter
     
    org.gradle.api.file.FileCollection
     
    protected com.github.jengelman.gradle.plugins.shadow.internal.ZipCompressor
     
    com.github.jengelman.gradle.plugins.shadow.tasks.InheritManifest
     
     
    List<com.github.jengelman.gradle.plugins.shadow.relocation.Relocator>
     
    protected org.gradle.api.tasks.util.PatternSet
    Utility method for assisting between changes in Gradle 1.12 and 2.x.
    com.github.jengelman.gradle.plugins.shadow.ShadowStats
     
    List<com.github.jengelman.gradle.plugins.shadow.transformers.Transformer>
     
    boolean
     
    Syntactic sugar for merging Groovy extension module descriptor files in JARs
    Syntactic sugar for merging service files in JARs.
    Syntactic sugar for merging service files in JARs.
    mergeServiceFiles(org.gradle.api.Action<com.github.jengelman.gradle.plugins.shadow.transformers.ServiceFileTransformer> configureClosure)
    Syntactic sugar for merging service files in JARs.
     
    minimize(org.gradle.api.Action<com.github.jengelman.gradle.plugins.shadow.internal.DependencyFilter> c)
     
    relocate(com.github.jengelman.gradle.plugins.shadow.relocation.Relocator relocator)
    Add a relocator instance.
    relocate(Class<? extends com.github.jengelman.gradle.plugins.shadow.relocation.Relocator> relocatorClass)
    Add a relocator of the provided class.
    <R extends com.github.jengelman.gradle.plugins.shadow.relocation.Relocator>
    ShadowJar
    relocate(Class<R> relocatorClass, org.gradle.api.Action<R> configure)
    Add a relocator of the provided class and configure.
    relocate(String pattern, String destination)
    Add a class relocator that maps each class in the pattern to the provided destination.
    relocate(String pattern, String destination, org.gradle.api.Action<com.github.jengelman.gradle.plugins.shadow.relocation.SimpleRelocator> configure)
    Add a class relocator that maps each class in the pattern to the provided destination.
    void
    setConfigurations(List<org.gradle.api.file.FileCollection> configurations)
     
    void
    setDependencyFilter(com.github.jengelman.gradle.plugins.shadow.internal.DependencyFilter filter)
     
    void
    setEnableRelocation(boolean enableRelocation)
     
    void
    setRelocationPrefix(String relocationPrefix)
     
    void
    setRelocators(List<com.github.jengelman.gradle.plugins.shadow.relocation.Relocator> relocators)
     
    void
    setTransformers(List<com.github.jengelman.gradle.plugins.shadow.transformers.Transformer> transformers)
     
    transform(com.github.jengelman.gradle.plugins.shadow.transformers.Transformer transformer)
    Add a preconfigured transformer instance.
    transform(Class<? extends com.github.jengelman.gradle.plugins.shadow.transformers.Transformer> clazz)
    Add a Transformer instance for modifying JAR resources and configure.
    <T extends com.github.jengelman.gradle.plugins.shadow.transformers.Transformer>
    ShadowJar
    transform(Class<T> clazz, org.gradle.api.Action<T> c)
    Add a Transformer instance for modifying JAR resources and configure.

    Methods inherited from class org.gradle.api.tasks.bundling.Jar

    manifest

    Methods inherited from class org.gradle.jvm.tasks.Jar

    getManifestContentCharset, getMetadataCharset, getMetaInf, manifest, metaInf, metaInf, setManifest, setManifestContentCharset, setMetadataCharset

    Methods inherited from class org.gradle.api.tasks.bundling.Zip

    getCompressor, getEntryCompression, isZip64, setEntryCompression, setZip64

    Methods inherited from class org.gradle.api.tasks.bundling.AbstractArchiveTask

    createCopyActionExecuter, getArchiveAppendix, getArchiveBaseName, getArchiveClassifier, getArchiveExtension, getArchiveFile, getArchiveFileName, getArchivePath, getArchiveVersion, getDestinationDirectory, into, into, into, isPreserveFileTimestamps, isReproducibleFileOrder, setPreserveFileTimestamps, setReproducibleFileOrder

    Methods inherited from class org.gradle.api.tasks.AbstractCopyTask

    createRootSpec, dirPermissions, eachFile, eachFile, exclude, exclude, exclude, exclude, expand, expand, filePermissions, filesMatching, filesMatching, filesNotMatching, filesNotMatching, filter, filter, filter, filter, from, from, from, getDirectoryFileTreeFactory, getDirMode, getDirPermissions, getDocumentationRegistry, getDuplicatesStrategy, getExcludes, getFileLookup, getFileMode, getFilePermissions, 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

    Methods inherited from class org.gradle.api.internal.ConventionTask

    conventionMapping, conventionMapping, getConventionMapping

    Methods 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, usesService

    Methods inherited from class org.gradle.api.internal.AbstractTask

    acceptServiceReferences, 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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.gradle.api.file.CopyProcessingSpec

    dirPermissions, filePermissions, getDirMode, getDirPermissions, getFileMode, getFilePermissions, setDirMode, setFileMode

    Methods inherited from interface org.gradle.api.file.CopySpec

    eachFile, eachFile, exclude, exclude, exclude, exclude, expand, expand, filesMatching, filesMatching, filesNotMatching, filesNotMatching, filter, filter, filter, filter, from, from, from, getDuplicatesStrategy, getFilteringCharset, getIncludeEmptyDirs, include, include, include, include, into, into, into, isCaseSensitive, rename, rename, rename, rename, setCaseSensitive, setDuplicatesStrategy, setExcludes, setFilteringCharset, setIncludeEmptyDirs, setIncludes, with

    Methods inherited from interface org.gradle.api.tasks.util.PatternFilterable

    getExcludes, getIncludes

    Methods inherited from interface org.gradle.api.Task

    doNotTrackState, getConvention, notCompatibleWithConfigurationCache
  • Constructor Details

    • ShadowJar

      public ShadowJar()
  • Method Details

    • minimize

      public ShadowJar minimize()
    • minimize

      public ShadowJar minimize(org.gradle.api.Action<com.github.jengelman.gradle.plugins.shadow.internal.DependencyFilter> c)
    • getStats

      @Internal public com.github.jengelman.gradle.plugins.shadow.ShadowStats getStats()
    • getManifest

      public com.github.jengelman.gradle.plugins.shadow.tasks.InheritManifest getManifest()
      Overrides:
      getManifest in class org.gradle.jvm.tasks.Jar
    • createCopyAction

      @NotNull protected @NotNull org.gradle.api.internal.file.copy.CopyAction createCopyAction()
      Overrides:
      createCopyAction in class org.gradle.api.tasks.bundling.Zip
    • getInternalCompressor

      @Internal protected com.github.jengelman.gradle.plugins.shadow.internal.ZipCompressor getInternalCompressor()
    • copy

      protected void copy()
      Overrides:
      copy in class org.gradle.api.tasks.AbstractCopyTask
    • getIncludedDependencies

      @Classpath public org.gradle.api.file.FileCollection getIncludedDependencies()
    • getRootPatternSet

      @Internal protected org.gradle.api.tasks.util.PatternSet getRootPatternSet()
      Utility method for assisting between changes in Gradle 1.12 and 2.x.
      Returns:
      this
    • dependencies

      public ShadowJar dependencies(org.gradle.api.Action<com.github.jengelman.gradle.plugins.shadow.internal.DependencyFilter> c)
      Configure inclusion/exclusion of module and project dependencies into uber jar.
      Parameters:
      c - the configuration of the filter
      Returns:
      this
    • transform

      public ShadowJar transform(Class<? extends com.github.jengelman.gradle.plugins.shadow.transformers.Transformer> clazz) throws InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException
      Add a Transformer instance for modifying JAR resources and configure.
      Parameters:
      clazz - the transformer to add. Must have a no-arg constructor
      Returns:
      this
      Throws:
      InstantiationException
      IllegalAccessException
      NoSuchMethodException
      InvocationTargetException
    • transform

      public <T extends com.github.jengelman.gradle.plugins.shadow.transformers.Transformer> ShadowJar transform(Class<T> clazz, org.gradle.api.Action<T> c) throws InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException
      Add a Transformer instance for modifying JAR resources and configure.
      Parameters:
      clazz - the transformer class to add. Must have no-arg constructor
      c - the configuration for the transformer
      Returns:
      this
      Throws:
      InstantiationException
      IllegalAccessException
      NoSuchMethodException
      InvocationTargetException
    • transform

      public ShadowJar transform(com.github.jengelman.gradle.plugins.shadow.transformers.Transformer transformer)
      Add a preconfigured transformer instance.
      Parameters:
      transformer - the transformer instance to add
      Returns:
      this
    • mergeServiceFiles

      public ShadowJar mergeServiceFiles()
      Syntactic sugar for merging service files in JARs.
      Returns:
      this
    • mergeServiceFiles

      public ShadowJar mergeServiceFiles(String rootPath)
      Syntactic sugar for merging service files in JARs.
      Returns:
      this
    • mergeServiceFiles

      public ShadowJar mergeServiceFiles(org.gradle.api.Action<com.github.jengelman.gradle.plugins.shadow.transformers.ServiceFileTransformer> configureClosure)
      Syntactic sugar for merging service files in JARs.
      Returns:
      this
    • mergeGroovyExtensionModules

      public ShadowJar mergeGroovyExtensionModules()
      Syntactic sugar for merging Groovy extension module descriptor files in JARs
      Returns:
      this
    • append

      public ShadowJar append(String resourcePath)
      Syntax sugar for merging service files in JARs
      Returns:
      this
    • relocate

      public ShadowJar relocate(String pattern, String destination)
      Add a class relocator that maps each class in the pattern to the provided destination.
      Parameters:
      pattern - the source pattern to relocate
      destination - the destination package
      Returns:
      this
    • relocate

      public ShadowJar relocate(String pattern, String destination, org.gradle.api.Action<com.github.jengelman.gradle.plugins.shadow.relocation.SimpleRelocator> configure)
      Add a class relocator that maps each class in the pattern to the provided destination.
      Parameters:
      pattern - the source pattern to relocate
      destination - the destination package
      configure - the configuration of the relocator
      Returns:
      this
    • relocate

      public ShadowJar relocate(com.github.jengelman.gradle.plugins.shadow.relocation.Relocator relocator)
      Add a relocator instance.
      Parameters:
      relocator - the relocator instance to add
      Returns:
      this
    • relocate

      public ShadowJar relocate(Class<? extends com.github.jengelman.gradle.plugins.shadow.relocation.Relocator> relocatorClass) throws InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException
      Add a relocator of the provided class.
      Parameters:
      relocatorClass - the relocator class to add. Must have a no-arg constructor.
      Returns:
      this
      Throws:
      InstantiationException
      IllegalAccessException
      NoSuchMethodException
      InvocationTargetException
    • relocate

      public <R extends com.github.jengelman.gradle.plugins.shadow.relocation.Relocator> ShadowJar relocate(Class<R> relocatorClass, org.gradle.api.Action<R> configure) throws InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException
      Add a relocator of the provided class and configure.
      Parameters:
      relocatorClass - the relocator class to add. Must have a no-arg constructor
      configure - the configuration for the relocator
      Returns:
      this
      Throws:
      InstantiationException
      IllegalAccessException
      NoSuchMethodException
      InvocationTargetException
    • getTransformers

      public List<com.github.jengelman.gradle.plugins.shadow.transformers.Transformer> getTransformers()
    • setTransformers

      public void setTransformers(List<com.github.jengelman.gradle.plugins.shadow.transformers.Transformer> transformers)
    • getRelocators

      public List<com.github.jengelman.gradle.plugins.shadow.relocation.Relocator> getRelocators()
    • setRelocators

      public void setRelocators(List<com.github.jengelman.gradle.plugins.shadow.relocation.Relocator> relocators)
    • getConfigurations

      @Classpath @Optional public List<org.gradle.api.file.FileCollection> getConfigurations()
    • setConfigurations

      public void setConfigurations(List<org.gradle.api.file.FileCollection> configurations)
    • getDependencyFilter

      @Internal public com.github.jengelman.gradle.plugins.shadow.internal.DependencyFilter getDependencyFilter()
    • setDependencyFilter

      public void setDependencyFilter(com.github.jengelman.gradle.plugins.shadow.internal.DependencyFilter filter)
    • isEnableRelocation

      @Input public boolean isEnableRelocation()
    • setEnableRelocation

      public void setEnableRelocation(boolean enableRelocation)
    • getRelocationPrefix

      @Input public String getRelocationPrefix()
    • setRelocationPrefix

      public void setRelocationPrefix(String relocationPrefix)