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:37:55 UTC

[flink] branch cron-master-e2e updated: [FLINK-11628][travis] Cache maven

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

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


The following commit(s) were added to refs/heads/cron-master-e2e by this push:
     new 76eccb6  [FLINK-11628][travis] Cache maven
76eccb6 is described below

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

    [FLINK-11628][travis] Cache maven
---
 .travis.yml                 | 12 +++---------
 tools/travis/setup_maven.sh | 38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+), 9 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 91c8d49..78d7eac 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:
@@ -167,15 +169,7 @@ before_install:
    - curl -L https://github.com/docker/compose/releases/download/1.21.1/docker-compose-`uname -s`-`uname -m` > docker-compose
    - chmod +x docker-compose
    - sudo mv docker-compose /usr/local/bin
-   # Install maven 3.2.5 since trusty uses 3.3.9 for which shading is broken
-   - "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 {} ; fi'' \;'
+   - source ./tools/travis/setup_maven.sh
 
 notifications:
   slack:
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
+