Strabon

diff scripts/workaround/deploy-local-repo.sh @ 1042:8495c0c9b597

Strabon build fails due to the recent dissapearence of Aduna's maven repository
author Kostis Kyzirakos <kkyzir@di.uoa.gr>
date Thu Apr 18 15:42:46 2013 +0300 (2013-04-18)
parents
children f266f9932ce4
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/scripts/workaround/deploy-local-repo.sh	Thu Apr 18 15:42:46 2013 +0300
     1.3 @@ -0,0 +1,84 @@
     1.4 +#!/bin/bash
     1.5 +# check your ~/.m2/settings.xml for the correct values
     1.6 +DEPLOY_REPO_ID="strabon.testing"
     1.7 +DEPLOY_REPO_URL="http://maven.strabon.di.uoa.gr/content/repositories/testing/"
     1.8 +TEMP_DIR="/tmp/deploy-local-repo-$$"
     1.9 +
    1.10 +mkdir ${TEMP_DIR}
    1.11 +if [[ ! -d "${TEMP_DIR}" ]] ; then
    1.12 +	echo "Could not create temporary directory."
    1.13 +	echo "Aborting..."
    1.14 +	exit
    1.15 +fi
    1.16 +
    1.17 +
    1.18 +for d in `find ${HOME}/.m2/repository -type d` ;
    1.19 +do
    1.20 +	#for each directory
    1.21 +	cd ${d}
    1.22 +	children=`find . -type d|wc -l`
    1.23 +	if [[ "${children}" -ne "1" ]] ; then
    1.24 +		# if the directory has more subdirectories, move one
    1.25 +		continue;
    1.26 +	fi
    1.27 +
    1.28 +	countPoms=`ls -1 *.pom 2>/dev/null|wc -l`
    1.29 +	countJars=`ls -1 *.pom 2>/dev/null|wc -l`
    1.30 +
    1.31 +	if [[ "${countPoms}" -gt "1" ]] && [[ "${countJars}" -gt "1" ]] ; then
    1.32 +		echo "Found ${countPoms} poms and ${countJars} jars in directory '${d}'."
    1.33 +		echo "Aborting..."
    1.34 +		exit;
    1.35 +	elif [[ "${countPoms}" -eq "0" ]] ; then
    1.36 +		echo "No .pom file found in directory '${d}'."
    1.37 +		echo "Aborting..."
    1.38 +		exit;
    1.39 +	fi
    1.40 +
    1.41 +	pomFile=`ls -1 *.pom 2>/dev/null`
    1.42 +	jarFile=`ls -1 *.jar 2>/dev/null`
    1.43 +	cp ${pomFile} ${TEMP_DIR}/${pomFile} 2>/dev/null
    1.44 +	cp ${jarFile} ${TEMP_DIR}/${jarFile} 2>/dev/null
    1.45 +
    1.46 +
    1.47 +	if [[ "${countPoms}" -eq "1" ]] && [[ "${countJars}" -eq "1" ]] ; then
    1.48 +		# deploy the local jar file to the remote repo
    1.49 +		mvn deploy:deploy-file \
    1.50 +			-DrepositoryId=${DEPLOY_REPO_ID} \
    1.51 +			-Durl=${DEPLOY_REPO_URL} \
    1.52 +			-DpomFile=${TEMP_DIR}/${pomFile} \
    1.53 +			-Dfile=${TEMP_DIR}/${jarFile};
    1.54 +	elif [[ "${countPoms}" -eq "1" ]] && [[ "${countJars}" -eq "0" ]] ; then
    1.55 +		# deploy the local pom file to the remote repo
    1.56 +		mvn deploy:deploy-file \
    1.57 +			-DrepositoryId=${DEPLOY_REPO_ID} \
    1.58 +			-Durl=${DEPLOY_REPO_URL} \
    1.59 +			-DpomFile=${TEMP_DIR}/${pomFile} \
    1.60 +			-Dfile=${TEMP_DIR}/${pomFile};
    1.61 +	else
    1.62 +		echo "Found ${countPoms} poms and ${countJars} jars in directory '${d}'."
    1.63 +		echo "What should I do?"
    1.64 +		echo "Aborting..."
    1.65 +		exit;
    1.66 +	fi
    1.67 +
    1.68 +	pomFile=`ls -1 *.pom`
    1.69 +	jarFile=`ls -1 *.jar`
    1.70 +
    1.71 +	cp ${pomFile} ${TEMP_DIR}/${pomFile}
    1.72 +	cp ${jarFile} ${TEMP_DIR}/${jarFile}
    1.73 +
    1.74 +	# deploy the local file to the remote repo
    1.75 +	mvn deploy:deploy-file \
    1.76 +		-DrepositoryId=${DEPLOY_REPO_ID} \
    1.77 +		-Durl=${DEPLOY_REPO_URL} \
    1.78 +		-DpomFile=${TEMP_DIR}/${pomFile} \
    1.79 +		-Dfile=${TEMP_DIR}/${jarFile};
    1.80 +
    1.81 +	# grooming
    1.82 +	rm ${TEMP_DIR}/*
    1.83 +done
    1.84 +
    1.85 +
    1.86 +# grooming
    1.87 +rm -rf ${TEMP_DIR}