diff --git a/tools/travis/before_install.sh b/tools/travis/before_install.sh
index 5f04c79d95b..69646a754c7 100755
--- a/tools/travis/before_install.sh
+++ b/tools/travis/before_install.sh
@@ -110,19 +110,17 @@ done
#Resolve remaining deps
cd tools/travis
-./downloadDeps.sh 2> /dev/null
echo -e "\nDownloading Project dependencies"
-echo -e "$(cat pom.xml |wc -l) lines in dummy pom.xml"
for ((i=0;i<$RETRY_COUNT;i++))
do
- mvn org.apache.maven.plugins:maven-dependency-plugin:resolve > /tmp/phase2
+ ./downloadDeps.sh > /tmp/phase2
if [[ $? -eq 0 ]]; then
- echo -e "\nProject dependencies downloaded successfully"
+ echo -e "\n$(cat cleandeps.out |wc -l) project dependencies downloaded successfully"
break;
fi
echo -e "\nDependency download failed"
- cat /tmp/phase2
+ cat /tmp/phase2 | grep -i -e "fail" -e "error" -e "exception"
#Test DNS record
getent hosts repo1.maven.org
while ! nc -vzw 5 repo1.maven.org 80; do echo -e "\nFailed to connect to repo1.maven.org:80 will retry in 10 seconds"; sleep 10; done
diff --git a/tools/travis/downloadDeps.sh b/tools/travis/downloadDeps.sh
index c7d60a26e81..6045feb0b4a 100755
--- a/tools/travis/downloadDeps.sh
+++ b/tools/travis/downloadDeps.sh
@@ -1,43 +1,43 @@
-#Create dummy pom
-echo '4.0.0org.apache.cloudstacktravis-build-depsDownload Deps for Travis CI1' > pom.xml
-
-#Get all dependency blocks
-for line in $(find ../../ -name pom.xml -exec sed -n '//{:a;n;/<\/dependencies>/b;p;ba}' {} \; | grep -e "artifactId" -e "groupId" -e "version" -e "dependency\>" -e "exclusion\>" -e "exclusions\>"); do
+for line in $(find ../../ -name pom.xml -exec sed -n '//{:a;n;/<\/dependencies>/b;p;ba}' {} \; | grep -e "artifactId" -e "groupId" -e "version" -e "dependency\>" -e "exclusion\>" -e "exclusions\>"| sed -e 's/\^M//'); do
#Tokenize values
set -- $(echo $line | awk -v FS="(>|<)" '{print $2, $3}')
#Start processing data
- if [ $1 == "dependency" ]; then
+ if [[ $1 == "dependency" ]]; then
#Create new artifact dep
- ARTIFACT=$line
- elif [ $1 == "/dependency" ]; then
- #Check if version is empty to fix maven 3.2.5 run
- if [[ $ARTIFACT != *version* ]]; then
- continue;
- fi
+ unset ARTIFACT
+ unset VERSION
+ unset GROUP
+ elif [[ $1 == "/dependency" ]]; then
#Filter out project modules interdependencies and noredist artifacts
- if [[ $ARTIFACT != *org.apache.cloudstack* ]] && [[ $ARTIFACT != *com.cloud* ]] && [[ $ARTIFACT != *org.midonet* ]] && [[ $ARTIFACT != *net.juniper* ]] ; then
- echo $ARTIFACT$line >> pom.xml
+ if [[ $GROUP != *org.apache.cloudstack* ]] && [[ $GROUP != *com.cloud* ]] && [[ $ARTIFACT != cloudstack-service-console-proxy-rdpclient ]]; then
+ if [[ -z $VERSION ]] ; then
+ VERSION=LATEST
+ if [[ $GROUP == jstl ]] || [[ $ARTIFACT == mysql-connector-java ]] || [[ $GROUP == org.apache.axis ]]; then
+ continue
+ fi
+ fi
+ echo "$GROUP $ARTIFACT $VERSION" >> deps.out
fi
- elif [ $1 == "version" ]; then
+ elif [[ $1 == "version" ]]; then
#If version is a maven var, get the value from parent pom
if [[ $2 == \$\{* ]]; then
-
- VER=$(grep \<$(echo $2 | awk -v FS="(}|{)" '{print $2 }') ../../pom.xml | awk -v FS="(>|<)" '{print $3}')
- if [[ "$VER" == "" ]]; then
- ARTIFACT=org.apache.cloudstack
- else
- ARTIFACT="$ARTIFACT$VER"
- fi
+ VERSION=$(grep \<$(echo $2 | awk -v FS="(}|{)" '{print $2 }') ../../pom.xml | awk -v FS="(>|<)" '{print $3}')
elif [[ "$2" == "" ]]; then
- ARTIFACT="$ARTIFACTLATEST"
+ VERSION="LATEST"
else
- ARTIFACT=$ARTIFACT$line
+ VERSION=$2
fi
- else
- ARTIFACT=$ARTIFACT$line
+ elif [[ $1 == "artifactId" ]]; then
+ if [[ -z $ARTIFACT ]]; then
+ ARTIFACT=$2
+ fi
+ elif [[ $1 == "groupId" ]]; then
+ if [[ -z $GROUP ]]; then
+ GROUP=$2
+ fi
fi
done
@@ -47,10 +47,66 @@ while read line ; do
NAME=$(echo $line | sed -e 's/.jar$//')
VERSION=${NAME##*-}
ARTIFACT=${NAME%-*}
- GROUP=$(find ~/.m2/repository -name ${NAME}.pom -exec sed -n "1,/${ARTIFACT}/p" {} \; | tac | grep -m 1 -e "" | sed -e 's/^[[:space:]]*//' | tr -d '\r')
- DATA="${GROUP}${ARTIFACT}${VERSION}"
- echo $DATA >> pom.xml
+ GROUP=$(find ~/.m2/repository -name ${NAME}.pom -exec sed -n "1,/${ARTIFACT}/p" {} \; | tac | grep -m 1 -e "" | sed -e 's/^[[:space:]]*//' -e 's/\^M//' | tr -d '\r' | awk -v FS="(>|<)" '{print $3}')
+ DATA="${GROUP} ${ARTIFACT} ${VERSION}"
+ echo $DATA >> deps.out
done < /tmp/resolvedPlugins
-#Finish dummy pom
-echo "" >> pom.xml
+cat deps.out | LANG=C sort -u > cleandeps.out
+
+LASTPOM=0
+echo '4.0.0org.apache.cloudstacktravis-build-depsDownload Deps for Travis CI1mido-maven-public-releasesmido-maven-public-releaseshttp://cs-maven.midokura.com/releasesjuniper-contrailhttp://juniper.github.io/contrail-maven/snapshots' > pom${LASTPOM}.xml
+while read line ; do
+ set -- $line
+
+ if [[ $2 == $LASTARTIFACT ]]; then
+ POMID=$(($POMID+1))
+ if [[ $POMID -gt $LASTPOM ]]; then
+ LASTPOM=$POMID
+ echo '4.0.0org.apache.cloudstacktravis-build-depsDownload Deps for Travis CI1mido-maven-public-releasesmido-maven-public-releaseshttp://cs-maven.midokura.com/releasesjuniper-contrailhttp://juniper.github.io/contrail-maven/snapshots' > pom${LASTPOM}.xml
+ fi
+ else
+ POMID=0
+ fi
+ LASTARTIFACT=$2
+ echo "$1$2$3" >> pom${POMID}.xml
+
+done < cleandeps.out
+
+RETURN_CODE=0
+for ((i=0;i<=$LASTPOM;i++))
+do
+ echo "" >> pom${i}.xml
+ mvn org.apache.maven.plugins:maven-dependency-plugin:resolve -f pom${i}.xml
+ if [[ $? -ne 0 ]]; then
+ RETURN_CODE=1
+ fi
+
+done
+
+#Run a few plugin goals to download some more deps
+
+#Hack to run maven-jaxb2-plugin generate, can be removed when we stop using such an old version...
+mkdir -p src/main/resources
+echo '' > src/main/resources/test.xsd
+
+
+declare -a arr=("maven-surefire-plugin test" "maven-pmd-plugin pmd" "maven-compiler-plugin compile" "maven-resources-plugin resources" "maven-checkstyle-plugin check" "maven-site-plugin attach-descriptor" "maven-surefire-plugin test" "maven-jar-plugin jar" "license-maven-plugin check" "maven-jgit-buildnumber-plugin extract-buildnumber" "maven-jaxb2-plugin generate" "maven-war-plugin war -DfailOnMissingWebXml=false" "gmaven-plugin compile")
+for i in "${arr[@]}"
+do
+ set -- $i
+ PLUGIN=$1
+ MOJO=$2
+ OPTION=$3
+ while read line ; do
+ set -- $line
+ JOBS="${JOBS} ${1}:${2}:${3}:${MOJO} $OPTION"
+ done < <(grep $PLUGIN cleandeps.out)
+done
+echo "Running $JOBS"
+mvn $JOBS -f pom0.xml
+
+
+rm -rf deps.out src target
+
+exit $RETURN_CODE