Class ServicesResourceTransformer
- java.lang.Object
-
- org.apache.maven.plugins.shade.resource.ServicesResourceTransformer
-
- All Implemented Interfaces:
ResourceTransformer
public class ServicesResourceTransformer extends java.lang.Object implements ResourceTransformer
Resources transformer that relocates classes in META-INF/services and appends entries in META-INF/services resources into a single resource. For example, if there are several META-INF/services/org.apache.maven.project.ProjectBuilder resources spread across many JARs the individual entries will all be concatenated into a single META-INF/services/org.apache.maven.project.ProjectBuilder resource packaged into the resultant JAR produced by the shading process.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
ServicesResourceTransformer.ServiceStream
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<Relocator>
relocators
private java.util.Map<java.lang.String,ServicesResourceTransformer.ServiceStream>
serviceEntries
private static java.lang.String
SERVICES_PATH
-
Constructor Summary
Constructors Constructor Description ServicesResourceTransformer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canTransformResource(java.lang.String resource)
boolean
hasTransformedResource()
void
modifyOutputStream(java.util.jar.JarOutputStream jos)
void
processResource(java.lang.String resource, java.io.InputStream is, java.util.List<Relocator> relocators)
Transform an individual resource
-
-
-
Field Detail
-
SERVICES_PATH
private static final java.lang.String SERVICES_PATH
- See Also:
- Constant Field Values
-
serviceEntries
private java.util.Map<java.lang.String,ServicesResourceTransformer.ServiceStream> serviceEntries
-
relocators
private java.util.List<Relocator> relocators
-
-
Method Detail
-
canTransformResource
public boolean canTransformResource(java.lang.String resource)
- Specified by:
canTransformResource
in interfaceResourceTransformer
-
processResource
public 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 interfaceResourceTransformer
- Parameters:
resource
- The resoure nameis
- An input stream for the resource, the implementation should *not* close this streamrelocators
- A list of relocators- Throws:
java.io.IOException
- When the IO blows up
-
hasTransformedResource
public boolean hasTransformedResource()
- Specified by:
hasTransformedResource
in interfaceResourceTransformer
-
modifyOutputStream
public void modifyOutputStream(java.util.jar.JarOutputStream jos) throws java.io.IOException
- Specified by:
modifyOutputStream
in interfaceResourceTransformer
- Throws:
java.io.IOException
-
-