Strabon

annotate 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
rev   line source
kkyzir@1042 1 #!/bin/bash
kkyzir@1042 2 # check your ~/.m2/settings.xml for the correct values
kkyzir@1042 3 DEPLOY_REPO_ID="strabon.testing"
kkyzir@1042 4 DEPLOY_REPO_URL="http://maven.strabon.di.uoa.gr/content/repositories/testing/"
kkyzir@1042 5 TEMP_DIR="/tmp/deploy-local-repo-$$"
kkyzir@1042 6
kkyzir@1042 7 mkdir ${TEMP_DIR}
kkyzir@1042 8 if [[ ! -d "${TEMP_DIR}" ]] ; then
kkyzir@1042 9 echo "Could not create temporary directory."
kkyzir@1042 10 echo "Aborting..."
kkyzir@1042 11 exit
kkyzir@1042 12 fi
kkyzir@1042 13
kkyzir@1042 14
kkyzir@1042 15 for d in `find ${HOME}/.m2/repository -type d` ;
kkyzir@1042 16 do
kkyzir@1042 17 #for each directory
kkyzir@1042 18 cd ${d}
kkyzir@1042 19 children=`find . -type d|wc -l`
kkyzir@1042 20 if [[ "${children}" -ne "1" ]] ; then
kkyzir@1042 21 # if the directory has more subdirectories, move one
kkyzir@1042 22 continue;
kkyzir@1042 23 fi
kkyzir@1042 24
kkyzir@1042 25 countPoms=`ls -1 *.pom 2>/dev/null|wc -l`
kkyzir@1042 26 countJars=`ls -1 *.pom 2>/dev/null|wc -l`
kkyzir@1042 27
kkyzir@1042 28 if [[ "${countPoms}" -gt "1" ]] && [[ "${countJars}" -gt "1" ]] ; then
kkyzir@1042 29 echo "Found ${countPoms} poms and ${countJars} jars in directory '${d}'."
kkyzir@1042 30 echo "Aborting..."
kkyzir@1042 31 exit;
kkyzir@1042 32 elif [[ "${countPoms}" -eq "0" ]] ; then
kkyzir@1042 33 echo "No .pom file found in directory '${d}'."
kkyzir@1042 34 echo "Aborting..."
kkyzir@1042 35 exit;
kkyzir@1042 36 fi
kkyzir@1042 37
kkyzir@1042 38 pomFile=`ls -1 *.pom 2>/dev/null`
kkyzir@1042 39 jarFile=`ls -1 *.jar 2>/dev/null`
kkyzir@1042 40 cp ${pomFile} ${TEMP_DIR}/${pomFile} 2>/dev/null
kkyzir@1042 41 cp ${jarFile} ${TEMP_DIR}/${jarFile} 2>/dev/null
kkyzir@1042 42
kkyzir@1042 43
kkyzir@1042 44 if [[ "${countPoms}" -eq "1" ]] && [[ "${countJars}" -eq "1" ]] ; then
kkyzir@1042 45 # deploy the local jar file to the remote repo
kkyzir@1042 46 mvn deploy:deploy-file \
kkyzir@1042 47 -DrepositoryId=${DEPLOY_REPO_ID} \
kkyzir@1042 48 -Durl=${DEPLOY_REPO_URL} \
kkyzir@1042 49 -DpomFile=${TEMP_DIR}/${pomFile} \
kkyzir@1042 50 -Dfile=${TEMP_DIR}/${jarFile};
kkyzir@1042 51 elif [[ "${countPoms}" -eq "1" ]] && [[ "${countJars}" -eq "0" ]] ; then
kkyzir@1042 52 # deploy the local pom file to the remote repo
kkyzir@1042 53 mvn deploy:deploy-file \
kkyzir@1042 54 -DrepositoryId=${DEPLOY_REPO_ID} \
kkyzir@1042 55 -Durl=${DEPLOY_REPO_URL} \
kkyzir@1042 56 -DpomFile=${TEMP_DIR}/${pomFile} \
kkyzir@1042 57 -Dfile=${TEMP_DIR}/${pomFile};
kkyzir@1042 58 else
kkyzir@1042 59 echo "Found ${countPoms} poms and ${countJars} jars in directory '${d}'."
kkyzir@1042 60 echo "What should I do?"
kkyzir@1042 61 echo "Aborting..."
kkyzir@1042 62 exit;
kkyzir@1042 63 fi
kkyzir@1042 64
kkyzir@1042 65 pomFile=`ls -1 *.pom`
kkyzir@1042 66 jarFile=`ls -1 *.jar`
kkyzir@1042 67
kkyzir@1042 68 cp ${pomFile} ${TEMP_DIR}/${pomFile}
kkyzir@1042 69 cp ${jarFile} ${TEMP_DIR}/${jarFile}
kkyzir@1042 70
kkyzir@1042 71 # deploy the local file to the remote repo
kkyzir@1042 72 mvn deploy:deploy-file \
kkyzir@1042 73 -DrepositoryId=${DEPLOY_REPO_ID} \
kkyzir@1042 74 -Durl=${DEPLOY_REPO_URL} \
kkyzir@1042 75 -DpomFile=${TEMP_DIR}/${pomFile} \
kkyzir@1042 76 -Dfile=${TEMP_DIR}/${jarFile};
kkyzir@1042 77
kkyzir@1042 78 # grooming
kkyzir@1042 79 rm ${TEMP_DIR}/*
kkyzir@1042 80 done
kkyzir@1042 81
kkyzir@1042 82
kkyzir@1042 83 # grooming
kkyzir@1042 84 rm -rf ${TEMP_DIR}