org.milyn
Class ResourceMerger

java.lang.Object
  extended by org.milyn.ResourceMerger

public class ResourceMerger
extends Object

ResourceMerger is able to merge java archives (jars) and in the process merge any text based resource files.

The primary use case for this class is when building the smooks-all.jar which consists of all the jars in the Smooks project. In Smooks there are a few types of resource files like 'content-handlers.inf', 'data-decoders.inf' that exist in mulitple jars. This works well when loading resources from the classpath as all jars will be searched and read. But when there is only a single jar then only one of the jars resource files will be in the merged jar and the others will be ignored.

Author:
Daniel Bevenius

Constructor Summary
ResourceMerger(List<String> resourcesPaths)
           
ResourceMerger(String resourcePath)
           
 
Method Summary
 Archive mergeJars(String jarname, File... archives)
          Will merge the jar files and produce a new jar with the contents of the resources configured merge together.
 Archive mergeJars(String jarname, List<Archive> archives)
          Will merge the jar files and produce a new jar with the contents of the resources configured merge together.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceMerger

public ResourceMerger(String resourcePath)
Parameters:
resourcePath - The path to the resource that should be merged into the jar produced by the merge method.

ResourceMerger

public ResourceMerger(List<String> resourcesPaths)
Parameters:
resourcesPaths - The path to the resource that should be merged into the jar produced by the merge method.
Method Detail

mergeJars

public Archive mergeJars(String jarname,
                         File... archives)
                  throws IOException
Will merge the jar files and produce a new jar with the contents of the resources configured merge together.

Parameters:
jarname - Can be an existing jar file or will be the name of the new archive created.
archives - An array of jar that are to be merge together.
Returns:
Archive A new jar that will be the result of merging the jars and will have the contents of the resources merged.
Throws:
IOException

mergeJars

public Archive mergeJars(String jarname,
                         List<Archive> archives)
                  throws IOException
Will merge the jar files and produce a new jar with the contents of the resources configured merge together.

Parameters:
jarname - Can be an existing jar file or will be the name of the new archive created.
archives - An array of jar that are to be merge together.
Returns:
Archive A new jar that will be the result of merging the jars and will have the contents of the resources merged.
Throws:
IOException


Copyright © 2014. All Rights Reserved.