Skip to content

Commit 5f2aa6c

Browse files
committed
Evergreen: Fix setting JAVA_HOME setting
run-mongodb-aws-ecs-test.sh can install jdk, so don't set the JAVA_HOME if the expected location doesn't exist. JAVA-4401 JAVA-4357
1 parent eada8a2 commit 5f2aa6c

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

.evergreen/javaConfig.bash

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
export JDK8="/opt/java/jdk8"
55
export JDK11="/opt/java/jdk11"
66
export JDK17="/opt/java/jdk17"
7-
export JAVA_HOME=$JDK11
7+
8+
if [ -d "$JDK11" ]; then
9+
export JAVA_HOME=$JDK11
10+
fi
811

912
export JAVA_VERSION=${JDK:-11}
1013

.evergreen/run-mongodb-aws-ecs-test.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ set -o errexit # Exit the script with error if any of the commands fail
1212
############################################
1313
# Main Program #
1414
############################################
15-
RELATIVE_DIR_PATH="$(dirname "${BASH_SOURCE:-$0}")"
16-
. "${RELATIVE_DIR_PATH}/javaConfig.bash"
1715

1816
if [[ -z "$1" ]]; then
1917
echo "usage: $0 <MONGODB_URI>"
@@ -36,6 +34,10 @@ if ! which git ; then
3634
fi
3735

3836
cd src
37+
38+
RELATIVE_DIR_PATH="$(dirname "${BASH_SOURCE:-$0}")"
39+
. "${RELATIVE_DIR_PATH}/javaConfig.bash"
40+
3941
./gradlew -version
4042

4143
echo "Running tests..."

0 commit comments

Comments
 (0)