Class ManifestResourceTransformer

  • All Implemented Interfaces:
    ReproducibleResourceTransformer, ResourceTransformer

    public class ManifestResourceTransformer
    extends java.lang.Object
    A resource processor that allows the arbitrary addition of attributes to the first MANIFEST.MF that is found in the set of JARs being processed, or to a newly created manifest for the shaded JAR.
    Since:
    1.2
    Author:
    Jason van Zyl
    • Constructor Detail

      • ManifestResourceTransformer

        public ManifestResourceTransformer()
    • Method Detail

      • setMainClass

        public void setMainClass​(java.lang.String mainClass)
      • setManifestEntries

        public void setManifestEntries​(java.util.Map<java.lang.String,​java.lang.Object> manifestEntries)
      • setAdditionalAttributes

        public void setAdditionalAttributes​(java.util.List<java.lang.String> additionalAttributes)
      • canTransformResource

        public boolean canTransformResource​(java.lang.String resource)
      • processResource

        public void processResource​(java.lang.String resource,
                                    java.io.InputStream is,
                                    java.util.List<Relocator> relocators,
                                    long time)
                             throws java.io.IOException
        Description copied from interface: ReproducibleResourceTransformer
        Transform an individual resource
        Parameters:
        resource - The resource name
        is - An input stream for the resource, the implementation should *not* close this stream
        relocators - A list of relocators
        time - the time of the resource to process
        Throws:
        java.io.IOException - When the IO blows up
      • hasTransformedResource

        public boolean hasTransformedResource()
      • modifyOutputStream

        public void modifyOutputStream​(java.util.jar.JarOutputStream jos)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • setForShade

        public void setForShade​(java.lang.String shade)
        The shades to apply this transformer to or no shades if no filter is applied.
        Parameters:
        shade - null, jar, test-jar, sources-jar or test-sources-jar.
      • isForShade

        public boolean isForShade​(java.lang.String shade)
      • isUsedForDefaultShading

        public boolean isUsedForDefaultShading()
      • processResource

        public final void processResource​(java.lang.String resource,
                                          java.io.InputStream is,
                                          java.util.List<Relocator> relocators)
                                   throws java.io.IOException
        Description copied from interface: ResourceTransformer
        Transform an individual resource
        Specified by:
        processResource in interface ResourceTransformer
        Parameters:
        resource - The resource name
        is - An input stream for the resource, the implementation should *not* close this stream
        relocators - A list of relocators
        Throws:
        java.io.IOException - When the IO blows up