GData Maven Deploy Script

July 10, 2010

I just wrote a quick script to deploy the latest GData versions to the LittleShoot maven repository, and I thought others might find it handy. GData doesn’t deploy to a maven repo, so you’ve got to do a little extra work. There are various solutions out there, but this is a little more straightforward. I’m jumping on board with Google’s latest 2.2.x alphas of their GData Java clients, as it looks like that’s where the future action will be. So this only applies to the 2.2.x alphas. The script simply takes the version argument, checks out that version from SVN, and deploys the jar to your repo.

You’ll want to swap out your repository for the LittleShoot repository listed at the end — both the URL and repository ID. If you want to just grab this script from the LittleShoot repository, it’s here.


#!/usr/bin/env bash

# This is a script for automatically deploying the GData jars to the LittleShoot
# maven repository.

gdataVersion=$1

function die() {
rm -rf $gdataVersion
echo $*
exit 1
}

me=`basename $0`

if [ $# -ne 1 ]
then
"Should be a single GData version argument, as in './$me 2.2.1-alpha'. For versions, see: http://gdata-java-client.googlecode.com/svn/tags/"
exit 1
fi

echo "Checking out GData version $gdataVersion"
svn co http://gdata-java-client.googlecode.com/svn/tags/$gdataVersion || die "Could not checkout SVN"

pushd $gdataVersion/gdata || die "Could not move to gdata base dir"
ant dist || die "Could not build with ant"
cd build-bin/dist/ || die "Could not cd to dist directory"

mvn deploy:deploy-file -DgroupId=com.google.gdata -DartifactId=gdata -Dversion=$gdataVersion -Dfile=gdata-$gdataVersion.jar -Dpackaging=jar -DgeneratePom=true -Durl=scpexe://dev.littleshoot.org/var/maven -DrepositoryId=littleshoot || die "Could not deploy file"

echo "Cleaning up"
popd
rm -rf $gdataVersion

Advertisements