public class JomcResourceTransformer extends org.codehaus.plexus.logging.AbstractLogEnabled implements org.apache.maven.plugins.shade.resource.ResourceTransformer
ResourceTransformer
implementation for shading JOMC resources.
Maven Shade Plugin Usage
<transformer implementation="org.jomc.mojo.JomcResourceTransformer"> <model>http://jomc.org/model</model> <modelContextFactoryClassName>class name</modelContextFactoryClassName> <modelContextAttributes> <modelContextAttribute> <key>The name of the attribute</key> <value>The name of the attribute</value> <type>The name of the class of the object.</type> </modelContextAttribute> </modelContextAttributes/> <moduleEncoding>${project.build.sourceEncoding}</moduleEncoding> <moduleName>${project.name}</moduleName> <moduleVersion>${project.version}</moduleVersion> <moduleVendor>${project.organization.name}</moduleVendor> <moduleResource>META-INF/custom-jomc.xml</moduleResource> <moduleResources> <moduleResource>META-INF/jomc.xml</moduleResource> </moduleResources> <moduleIncludes> <moduleInclude>module name</moduleInclude> </moduleIncludes> <moduleExcludes> <moduleExclude>module name</moduleExclude> </moduleExcludes> <modletEncoding>${project.build.sourceEncoding}</modletEncoding> <modletName>${project.name}</modletName> <modletVersion>${project.version}</modletVersion> <modletVendor>${project.organization.name}</modletVendor> <modletResource>META-INF/custom-jomc-modlet.xml</modletResource> <modletResources> <modletResource>META-INF/jomc-modlet.xml</modletResource> </modletResources> <modletIncludes> <modletInclude>modlet name</modletInclude> </modletIncludes> <modletExcludes> <modletExclude>modlet name</modletExclude> </modletExcludes> <modelObjectStylesheet>Location of a XSLT document to use for transforming the merged model document.</modelObjectStylesheet> <modletObjectStylesheet>Location of a XSLT document to use for transforming the merged modlet document.</modletObjectStylesheet> <providerLocation>META-INF/custom-services</providerLocation> <platformProviderLocation>${java.home}/jre/lib/custom-jomc.properties</platformProviderLocation> <modletLocation>META-INF/custom-jomc-modlet.xml</modletLocation> <modletSchemaSystemId>http://custom.host.tld/custom/path/jomc-modlet-1.3.xsd</modletSchemaSystemId> </transformer>
|
Constructor and Description |
---|
JomcResourceTransformer()
Creates a new
JomcResourceTransformer instance. |
Modifier and Type | Method and Description |
---|---|
boolean |
canTransformResource(String arg) |
protected URL |
getResource(String location)
Creates an
URL for a given resource location. |
boolean |
hasTransformedResource() |
void |
modifyOutputStream(JarOutputStream out) |
void |
processResource(InputStream in) |
void |
processResource(String name,
InputStream in,
List relocators) |
public JomcResourceTransformer()
JomcResourceTransformer
instance.public boolean canTransformResource(String arg)
canTransformResource
in interface org.apache.maven.plugins.shade.resource.ResourceTransformer
public void processResource(InputStream in) throws IOException
IOException
public void processResource(String name, InputStream in, List relocators) throws IOException
processResource
in interface org.apache.maven.plugins.shade.resource.ResourceTransformer
IOException
public boolean hasTransformedResource()
hasTransformedResource
in interface org.apache.maven.plugins.shade.resource.ResourceTransformer
public void modifyOutputStream(JarOutputStream out) throws IOException
modifyOutputStream
in interface org.apache.maven.plugins.shade.resource.ResourceTransformer
IOException
protected URL getResource(String location) throws IOException
URL
for a given resource location.
This method first searches the class loader of the class for a single resource matching location
. If
such a resource is found, the URL of that resource is returned. If no such resource is found, an attempt is made
to parse the given location to an URL. On successful parsing, that URL is returned. Failing that, the given
location is interpreted as a file name. If that file is found, the URL of that file is returned. Otherwise an
IOException
is thrown.
location
- The location to create an URL
from.URL
for location
.NullPointerException
- if location
is null
.IOException
- if creating an URL fails.Copyright © 2005-2013 The JOMC Project. All Rights Reserved.