Skip to content

Commit

Permalink
[FLINK-11628][travis] Cache maven
Browse files Browse the repository at this point in the history
  • Loading branch information
zentol committed Feb 15, 2019
1 parent ac9fc7c commit cf3eeca
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 8 deletions.
11 changes: 3 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
38 changes: 38 additions & 0 deletions tools/travis/setup_maven.sh
Original file line number Diff line number Diff line change
@@ -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:https://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

6 changes: 6 additions & 0 deletions tools/travis_controller.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit cf3eeca

Please sign in to comment.