forked from DanySK/Gravis-CI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-maven
32 lines (32 loc) · 1.28 KB
/
install-maven
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/echo This script needs to be sourced, not executed!
set -e
MIRROR="https://archive.apache.org/dist/maven/maven-3/"
echo "Fetching the latest available Maven from $MIRROR"
LATEST_MAVEN=$(travis_retry curl $MIRROR > >(python -c "
import re
import sys
versions = [
match
for line in sys.stdin.readlines()
for match in re.findall(r'.*href=\"(\d+\.\d+\.\d+)\/\">', line)
]
print(max(versions))
" ))
echo "Latest available version is $LATEST_MAVEN"
MAVEN_VERSION=${MAVEN_VERSION:-$LATEST_MAVEN}
echo "Installing Maven ${MAVEN_VERSION} on ${TRAVIS_OS_NAME}"
MAVEN_INSTALL_FOLDER="${HOME}"
echo "Creating ${MAVEN_INSTALL_FOLDER}"
mkdir -p $MAVEN_INSTALL_FOLDER
MAVEN_TARBALL="apache-maven-${MAVEN_VERSION}-bin.tar.gz"
MAVEN_DOWNLOAD_URL="${MIRROR}${MAVEN_VERSION}/binaries/${MAVEN_TARBALL}"
echo "Downloading Maven ${MAVEN_VERSION} from ${MAVEN_DOWNLOAD_URL} into ${MAVEN_INSTALL_FOLDER}"
MAVEN_INSTALLER_LOCATION="${MAVEN_INSTALL_FOLDER}/${MAVEN_TARBALL}"
travis_retry curl -sL $MAVEN_DOWNLOAD_URL --output $MAVEN_INSTALLER_LOCATION
echo "Unpacking ${MAVEN_INSTALLER_LOCATION}..."
tar xzvf "${MAVEN_INSTALLER_LOCATION}" --directory="${MAVEN_INSTALL_FOLDER}"
echo "Updating PATH..."
export PATH="$MAVEN_INSTALL_FOLDER/apache-maven-${MAVEN_VERSION}/bin:$PATH"
echo "Testing maven version"
mvn -v
set +e