Strabon

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