Hi there,

we have some Java-phobes...

We want to use the Maven Repository to share binary artifacts across
teams...

Has anyone got any BASH scripts which replicate Maven / ANT Tasks / Mercury?

At the moment the best I have is:

repo_dir=$(echo "${groupId}" | sed -n -e
"s:\.:/:gp")/${artifactId}/${version/-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]\.[0-9][0-9][0-9][0-9][0-9][0-9]-[0-9]*/-SNAPSHOT}/
repo_path=$repo_dir/${artifactId}-${version}${classifier:+-}${classifier}.${packaging}
local_path=~/.m2/repository/${repo_path}
remote_path=http://repo.mycompany.org/content/repositories/$(if [[
"$version" =~ ".*-SNAPSHOT|.*-[0-9]{8}\.[0-9]{6}-[0-9][0-9]*" ]] ; then echo
"snapshot"; else echo "release"; fi)/${repo_path}

1. Deploy:

curl -s -T ${file} ${remote_path}

2. Install

cp -f ${file} ${local_path}

3. Get

if [ -f $local_path ] ; then
        if [[ "$version" =~ ".*-SNAPSHOT|.*-[0-9]{8}\.[0-9]{6}-[0-9][09-]*"
]] ; then
                remote_status=$(curl --silent --remote-time --head -w
"%{http_code}" $remote_path -o /dev/null)
                if [ 200 -eq $remote_status ] ; then
                        curl --silent --remote-time -z $local_path
$remote_path;
                else
                        exit 1;
                fi
        fi
        echo $local_path
        exit 0
else
        mkdir -p $repo_dir
        remote_status=$(curl --silent --remote-time --head -w "%{http_code}"
$remote_path -o /dev/null)
        echo $remote_status
        if [ 200 -eq $remote_status ] ; then
                curl --silent --remote-time -o $local_path $remote_path;
        else
                exit 1;
        fi
        echo $local_path
        exit 0;
fi

But I'm wondering has any bash wizard got the metadata parsing working (so
that I can do proper time-stampped snapshots)

Reply via email to