Skip to content

Commit

Permalink
Merge pull request #2026 from travis-ci/arek-jdk
Browse files Browse the repository at this point in the history
fix openjdk repositories
  • Loading branch information
murtaza-swati authored Jun 3, 2022
2 parents 0c886e6 + b606dfb commit b0260a8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/travis/build/bash/travis_find_jdk_path.bash
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ travis_find_jdk_path() {
vendor="$2"
version="$3"
if [[ "$vendor" == "openjdk" ]]; then
apt_glob="/usr/lib/jvm/temurin-${version}.*jdk*"
apt_glob="/usr/lib/jvm/java-${version}-amazon-corretto"
elif [[ "$vendor" == "oracle" ]]; then
apt_glob="/usr*/lib/jvm/java-${version}-oracle"
fi
Expand Down
16 changes: 8 additions & 8 deletions lib/travis/build/bash/travis_install_jdk.bash
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@ travis_install_jdk_package() {
local JAVA_VERSION
JAVA_VERSION="$1"
sudo apt-get update -yqq
PACKAGE="temurin-${JAVA_VERSION}-jdk"
if [[ "$JAVA_VERSION" == "8" ]]; then
JAVA_VERSION="1.8.0"
fi
PACKAGE="java-${JAVA_VERSION}-amazon-corretto-jdk"
if ! dpkg -s "$PACKAGE" >/dev/null 2>&1; then
if dpkg-query -l temurin* >/dev/null 2>&1; then
dpkg-query -l temurin* | grep temurin | awk '{print $2}' | xargs sudo dpkg -P
fi
wget -qO - https://packages.adoptium.net/artifactory/api/gpg/key/public | sudo apt-key add -
sudo add-apt-repository --yes https://packages.adoptium.net/artifactory/deb
wget -O- https://apt.corretto.aws/corretto.key | sudo apt-key add -
sudo add-apt-repository 'deb https://apt.corretto.aws stable main'
sudo apt-get update -yqq
sudo apt-get -yqq --no-install-suggests --no-install-recommends install "$PACKAGE" || true
travis_cmd "export JAVA_HOME=/usr/lib/jvm/temurin-${JAVA_VERSION}-jdk-${TRAVIS_CPU_ARCH}" --echo
travis_cmd "export PATH=\"$JAVA_HOME/bin:$PATH\"" --echo
travis_cmd "export JAVA_HOME=/usr/lib/jvm/java-${JAVA_VERSION}-amazon-corretto" --echo
travis_cmd 'export PATH="$JAVA_HOME/bin:$PATH"' --echo
sudo update-java-alternatives -s "$PACKAGE"*
fi
}

0 comments on commit b0260a8

Please sign in to comment.