Show versions in Maven’s repository

Wondering what are the available versions for a certain library? Use the following shell script which displays the versions and if they’re available locally (l) or remote (r):

#!/bin/sh
REMOTE_REPO=http://www.ibiblio.org/maven
DIR="/shared/soft/java/maven-repository/$1"
echo "Available versions for $1:"
(
[ -d "$DIR" ] && ls $DIR/jars/*.jar | sed -e "s/.*\/$1-/$1-/;s/$/ (l)/";
curl -s $REMOTE_REPO/$1/jars/ 2>/dev/null |perl -ne'/HREF="(.*?\.jar)"/&& print $1,"(r)\n"'
) | sort | uniq

Example usage:

user@host:~> mversion quartz
Available versions for quartz:
quartz-1.0.2.jar(r)
quartz-1.0.7.jar(r)
quartz-1.0-b4.jar(r)
quartz-1.0.jar(r)
quartz-1.2.2.jar(r)
quartz-1.2.3.jar (l)
quartz-1.2.3.jar(r)
quartz-1.3.4.jar(r)
quartz-1.4.0.jar (l)
quartz-1.4.0.jar(r)
quartz-SNAPSHOT.jar(r)
tools

{ Comments are closed! }

advertise
mail
Bear
jobs