Search code examples
hadoophadoop-plugins

Is it possible to use several jars to specify job in hadoop?


I usually have common/shared libraries and actual job code in different jar files. Is it possible to recompile only one job jar file to execute hadoop command hadoop jar asd? If not is there workaround to simplify jar packaging?


Solution

  • I am using Ant to make the job jar. To include all common/shared libraries in the buildConfig.xml file you have to add such line:

    <zipgroupfileset dir="pathToAllCommonAndSharedLibraries" includes="**/*.jar" />
    

    Here is the simplest example of build config file.

    <?xml version="1.0" encoding="UTF-8"?>
    <project name="Example.makejar" default="jar" basedir=".">
        <target name="jar">
            <jar destfile="Example.jar" basedir="bin">
                <manifest></manifest>
                <zipgroupfileset dir="pathToAllCommonAndSharedLibraries" includes="**/*.jar" />
            </jar>
        </target>
    </project>