File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 194194FLINK_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+
197214echo_g " flink version: ${FLINK_VERSION} , major version: ${FLINK_MAJOR_VERSION} "
198215echo_g " build starting..."
199216
You can’t perform that action at this time.
0 commit comments