Skip to content

Commit 6e67156

Browse files
committed
fix
1 parent 6b74ba9 commit 6e67156

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

flink-doris-connector/build.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,23 @@ fi
194194
FLINK_MAJOR_VERSION=0
195195
[ ${FLINK_VERSION} != 0 ] && FLINK_MAJOR_VERSION=${FLINK_VERSION%.*}
196196

197+
# Sanity check: Flink 1.x requires JDK 1.8, Flink 2.x requires JDK 17
198+
JAVA_VERSION=$(java -version 2>&1 | awk -F'"' '/version/ {print $2}')
199+
if [ "${FLINK_PROFILE}" = "flink1" ]; then
200+
if [[ "${JAVA_VERSION}" != 1.8* ]]; then
201+
echo_r "Error: Flink ${FLINK_VERSION} requires JDK 1.8, but found version '${JAVA_VERSION}'."
202+
echo_r "Please switch to JDK 1.8 before building Flink 1.x."
203+
exit 1
204+
fi
205+
elif [ "${FLINK_PROFILE}" = "flink2" ]; then
206+
if [[ "${JAVA_VERSION}" != 17* ]]; then
207+
echo_r "Error: Flink ${FLINK_VERSION} requires JDK 17, but found version '${JAVA_VERSION}'."
208+
echo_r "Please switch to JDK 17 before building Flink 2.x."
209+
exit 1
210+
fi
211+
fi
212+
echo_g " JDK version check passed: ${JAVA_VERSION}"
213+
197214
echo_g " flink version: ${FLINK_VERSION}, major version: ${FLINK_MAJOR_VERSION}"
198215
echo_g " build starting..."
199216

0 commit comments

Comments
 (0)