Skip to content

Commit 7af1f60

Browse files
committed
[ci] Download openjdk8 from adoptopenjdk.net
1 parent 448f8d5 commit 7af1f60

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ os: linux
22
dist: bionic
33

44
language: java
5-
jdk: openjdk8
65

76
services:
87
- xvfb
98

109
before_install:
1110
- bash .travis/setup-secrets.sh
1211
- bash .travis/configure-maven.sh
12+
- bash .travis/install-openjdk.sh
13+
- source ${HOME}/java.env
1314
install: true
1415
before_script: true
1516
script: "source .travis/build.sh"
@@ -23,6 +24,7 @@ notifications:
2324
cache:
2425
directories:
2526
- "$HOME/.m2"
27+
- "$HOME/.cache"
2628

2729
env:
2830
global:

.travis/install-openjdk.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
set -e
3+
4+
source .travis/logger.sh
5+
6+
DOWNLOAD_URL="https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u232-b09/OpenJDK8U-jdk_x64_linux_hotspot_8u232b09.tar.gz"
7+
OPENJDK_ARCHIVE=$(basename $DOWNLOAD_URL)
8+
9+
LOCAL_DIR=${HOME}/.cache/openjdk
10+
TARGET_DIR=${HOME}/openjdk${OPENJDK_MAJOR}
11+
12+
mkdir -p ${LOCAL_DIR}
13+
mkdir -p ${TARGET_DIR}
14+
if [ ! -e ${LOCAL_DIR}/${OPENJDK_ARCHIVE} ]; then
15+
log_info "Downloading from ${DOWNLOAD_URL} to ${LOCAL_DIR}"
16+
wget --directory-prefix ${LOCAL_DIR} --timestamping --continue ${DOWNLOAD_URL}
17+
else
18+
log_info "Skipped download, file ${LOCAL_DIR}/${OPENJDK_ARCHIVE} already exists"
19+
fi
20+
21+
log_info "Extracting to ${TARGET_DIR}"
22+
tar --extract --file ${LOCAL_DIR}/${OPENJDK_ARCHIVE} -C ${TARGET_DIR} --strip-components=1
23+
24+
cat > ${HOME}/java.env <<EOF
25+
export JAVA_HOME="${TARGET_DIR}"
26+
export PATH="${TARGET_DIR}/bin:${PATH}"
27+
java -version
28+
EOF
29+
30+
log_info "OpenJDK can be used via ${HOME}/java.env"
31+
cat ${HOME}/java.env
32+
source ${HOME}/java.env

0 commit comments

Comments
 (0)