Google gdata library and maven

Despite a number of requests from a variety of users, there are as-yet no official maven versions of Google’s gdata client Java library. There are various scripts to push the .jar files into a local repo, and one project on Google code containing an older version of the client library, mavenized. I think it’s up to the code maintainers (Google) to put a process in place for pushing official maven versions of the gdata .jars out to the public repos. In the meantime, the best we can hope for is to load into local repos. However, a problem with the scripts I’ve seen is that they bake-in the various versions of the libraries to the script. So here’s my variant, which takes the artifact name and version from the .jar filename:

#!/bin/bash

for f in java/lib/*.jar
do
  if [[ $f =~ java/lib/gdata-([a-z-]*)-(.*)\.jar ]]; then
      n=${BASH_REMATCH[1]}
      v=${BASH_REMATCH[2]}

      echo "installing mvn artifact $n $v"
      mvn install:install-file -DgroupId=com.google.gdata \
          -DartifactId=$n -Dversion=$v -Dfile=$f -Dpackaging=jar \
          -DgeneratePom=true
  fi
done

Tested on my Linux system at home, but I’m expecting this to also run on Windows/cygwin when I get into the office tomorrow!

Update Thanks to ildella on Twitter for pointing out that there’s a maintained, up-to-date collection of maven-ized gdata artifacts on googlecode.

 newer · index · older