You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ch...@apache.org on 2019/02/15 12:23:03 UTC

[flink] branch release-1.6 updated: [FLINK-11628][travis] Cache maven

This is an automated email from the ASF dual-hosted git repository.

chesnay pushed a commit to branch release-1.6
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/release-1.6 by this push:
     new a268ae1  [FLINK-11628][travis] Cache maven
a268ae1 is described below

commit a268ae173fbaadb322096834705a788e898d9ef8
Author: zentol <ch...@apache.org>
AuthorDate: Fri Feb 15 11:33:36 2019 +0100

    [FLINK-11628][travis] Cache maven
---
 .travis.yml                  | 11 +++--------
 tools/travis/setup_maven.sh  | 38 ++++++++++++++++++++++++++++++++++++++
 tools/travis_mvn_watchdog.sh |  6 ++++++
 3 files changed, 47 insertions(+), 8 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 2bee7e2..658f6eb 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -22,6 +22,8 @@ dist: trusty
 cache:
   directories:
   - $HOME/.m2
+  # keep in sync with tools/travis/setup_maven.sh
+  - $HOME/maven_cache
 
 # do not cache our own artifacts
 before_cache:
@@ -105,14 +107,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 0000000..a02457d
--- /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_mvn_watchdog.sh b/tools/travis_mvn_watchdog.sh
index ae5e58c..f55595a 100755
--- a/tools/travis_mvn_watchdog.sh
+++ b/tools/travis_mvn_watchdog.sh
@@ -17,6 +17,12 @@
 # limitations under the License.
 ################################################################################
 
+echo $M2_HOME
+echo $PATH
+echo $MAVEN_OPTS
+
+mvn -version
+
 HERE="`dirname \"$0\"`"				# relative
 HERE="`( cd \"$HERE\" && pwd )`" 	# absolutized and normalized
 if [ -z "$HERE" ] ; then