When building Wowza plugins which require external dependencies (such as Apache Commons libraries), it is convenient to produce a single jar file for distribution, rather than relying on third parties to have the correct set of jars installed. The build.xml file in the Wowza IDE project can easily be converted to incorporate the contents of jar dependencies.
This example assumes that the jars to be included are in a folder called libs which in turn is located in the same folder as the src and bin directories (the root of the project).
After the core.build.dir property, add the following lines to build.xml:
<property name="marshall.dir" value="tmp"/>
<property name="addon.lib.dir" value="libs"/>
Then, replace the target section with
<target name="jar">
<mkdir dir="${marshall.dir}"/>
<unzip dest="${marshall.dir}">
<fileset dir="${addon.lib.dir}">
<include name="**/*.jar"/>
</fileset>
</unzip>
<jar jarfile="${wowza.lib.dir}/${jar.filename}">
<fileset dir="${core.build.dir}"/>
<fileset dir="${marshall.dir}"/>
</jar>
<delete dir="${marshall.dir}" />
</target>
These changes define a the path to the jar files and a temporary directory to marshal them in. Then, Ant unzips all of the jar files to the temporary directory, and finally includes them when building the output jar.
A complete build.xml might look like:
<?xml version="1.0"?>
<project name="WowzaWatchdog" default="jar" basedir="..">
<property name="wowza.lib.dir" value="/Library/WowzaMediaServer/lib"/>
<property name="jar.filename" value="WowzaWatchdog.jar"/>
<property name="core.build.dir" value="bin"/>
<property name="marshall.dir" value="tmp"/>
<property name="addon.lib.dir" value="libs"/>
<target name="jar">
<mkdir dir="${marshall.dir}"/>
<unzip dest="${marshall.dir}">
<fileset dir="${addon.lib.dir}">
<include name="**/*.jar"/>
</fileset>
</unzip>
<jar jarfile="${wowza.lib.dir}/${jar.filename}">
<fileset dir="${core.build.dir}"/>
<fileset dir="${marshall.dir}"/>
</jar>
<delete dir="${marshall.dir}" />
</target>
</project>
All the best,
~ Christopher