Created
July 26, 2013 18:45
-
-
Save t3rmin4t0r/6091263 to your computer and use it in GitHub Desktop.
fat jar creation script. hadoop classpath | ./fatjar.sh hadoop-fat.jar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
jso_file=$1 | |
read classpath | |
TMPDIR=$(mktemp -d -t classes-XXXXXX) | |
#echo jso: $jso_file | |
#echo classpath: $classpath | |
if [ "$CLASSPATH" == "" ] | |
then | |
CLASSPATH=./target/hadoop-jso-*.jar | |
fi | |
cp=(${classpath//:/ }) | |
for path in "${cp[@]}" | |
do | |
if [ -f $path ] | |
then | |
extension="${path##*.}" | |
if [ "$extension" == "jar" ] | |
then | |
jars[$[${#jars[@]}+1]]=$path | |
fi | |
fi | |
done | |
pushd $TMPDIR; | |
mkdir classes; | |
pushd classes; | |
echo ${jars[@]} | xargs -P 8 -n 1 jar xf; | |
jar -c0f ../fat.jar . | |
popd; | |
popd; | |
mv -v $TMPDIR/fat.jar $jso_file | |
rm -r $TMPDIR | |
#jar -c0vf $jso_file -C classes/ . | |
#exec java -classpath $CLASSPATH org.apache.hadoop.jso.tool.Linker $jso_file ${jars[@]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment