diff --git a/.travis.yml b/.travis.yml index a7b1eebb4929d..49b4527427e76 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,6 +25,8 @@ cache: directories: - $HOME/.m2 - $HOME/flink_cache + # keep in sync with tools/travis/setup_maven.sh + - $HOME/maven_cache # do not cache our own artifacts before_cache: @@ -51,14 +53,7 @@ before_script: # Install maven 3.2.5 since trusty uses 3.3.9 for which shading is broken before_install: - - "wget https://archive.apache.org/dist/maven/maven-3/3.2.5/binaries/apache-maven-3.2.5-bin.zip" - - "unzip -qq apache-maven-3.2.5-bin.zip" - - "rm apache-maven-3.2.5-bin.zip" - - "export M2_HOME=$PWD/apache-maven-3.2.5" - - "export PATH=$M2_HOME/bin:$PATH" - - "export MAVEN_OPTS=\"-Dorg.slf4j.simpleLogger.showDateTime=true -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss.SSS\"" -# just in case: clean up the .m2 home and remove invalid jar files - - 'test ! -d $HOME/.m2/repository/ || find $HOME/.m2/repository/ -name "*.jar" -exec sh -c ''if ! zip -T {} >/dev/null ; then echo "deleting invalid file: {}"; rm -f {} ; fi'' \;' + - source ./tools/travis/setup_maven.sh # Installing the specified docker compose version - sudo rm /usr/local/bin/docker-compose - curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose diff --git a/tools/travis/setup_maven.sh b/tools/travis/setup_maven.sh new file mode 100755 index 0000000000000..a02457da44af1 --- /dev/null +++ b/tools/travis/setup_maven.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +################################################################################ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +################################################################################ + +MAVEN_VERSION="3.2.5" +MAVEN_CACHE_DIR=${HOME}/maven_cache +MAVEN_VERSIONED_DIR=${MAVEN_CACHE_DIR}/apache-maven-${MAVEN_VERSION} + +if [ ! -d "${MAVEN_VERSIONED_DIR}" ]; then + wget https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.zip + unzip -d "${MAVEN_CACHE_DIR}" -qq "apache-maven-${MAVEN_VERSION}-bin.zip" + rm "/apache-maven-${MAVEN_VERSION}-bin.zip" +fi + +export M2_HOME="${MAVEN_VERSIONED_DIR}" +export PATH=${M2_HOME}/bin:${PATH} +export MAVEN_OPTS="-Dorg.slf4j.simpleLogger.showDateTime=true -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss.SSS" + +# just in case: clean up the .m2 home and remove invalid jar files +if [ -d "${HOME}/.m2/repository/" ]; then + find ${HOME}/.m2/repository/ -name "*.jar" -exec sh -c 'if ! zip -T {} >/dev/null ; then echo "deleting invalid file: {}"; rm -f {} ; fi' \; +fi + diff --git a/tools/travis_controller.sh b/tools/travis_controller.sh index 6aa08e0d659b8..4868057c6cfd0 100755 --- a/tools/travis_controller.sh +++ b/tools/travis_controller.sh @@ -17,6 +17,12 @@ # limitations under the License. ################################################################################ +echo $M2_HOME +echo $PATH +echo $MAVEN_OPTS + +mvn -version + CACHE_DIR="$HOME/flink_cache" CACHE_BUILD_DIR="$CACHE_DIR/$TRAVIS_BUILD_NUMBER" CACHE_FLINK_DIR="$CACHE_BUILD_DIR/flink"