Created
November 26, 2009 05:40
-
-
Save shenie/243263 to your computer and use it in GitHub Desktop.
Download sources from maven
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 | |
prefix="http://mirrors.ibiblio.org/pub/mirrors/maven2" | |
header="/tmp/$0.header.$$" | |
find . -name "*.jar" -and ! -name "*sources.jar" | grep -v "siteminder" | \ | |
while read j | |
do | |
source_jar=$(echo $j | sed -e's/.jar/-sources.jar/') | |
if [ ! -e $source_jar ] ; then | |
echo "Downloading ${source_jar}" | |
pushd $(dirname $source_jar) >/dev/null 2>&1 | |
curl -D $header -O "${prefix}/${source_jar}" >/dev/null 2>&1 | |
popd >/dev/null 2>&1 | |
error=$(fgrep -c "404 Not Found" $header) | |
if [ $error -ne 0 ] ; then | |
echo "It does not exist..." | |
rm $source_jar 2>/dev/null | |
fi | |
fi | |
done | |
rm $header |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment