Skip to content

Commit 75a0327

Browse files
pwendelltdas
authored andcommitted
SPARK-1911: Emphasize that Spark jars should be built with Java 6.
This commit requires the user to manually say "yes" when buiding Spark without Java 6. The prompt can be bypassed with a flag (e.g. if the user is scripting around make-distribution). Author: Patrick Wendell <[email protected]> Closes apache#859 from pwendell/java6 and squashes the following commits: 4921133 [Patrick Wendell] Adding Pyspark Notice fee8c9e [Patrick Wendell] SPARK-1911: Emphasize that Spark jars should be built with Java 6.
1 parent 5081a0a commit 75a0327

File tree

1 file changed

+31
-21
lines changed

1 file changed

+31
-21
lines changed

make-distribution.sh

+31-21
Original file line numberDiff line numberDiff line change
@@ -46,27 +46,6 @@ set -e
4646
FWDIR="$(cd `dirname $0`; pwd)"
4747
DISTDIR="$FWDIR/dist"
4848

49-
if [ -z "$JAVA_HOME" ]; then
50-
echo "Error: JAVA_HOME is not set, cannot proceed."
51-
exit -1
52-
fi
53-
54-
JAVA_CMD="$JAVA_HOME"/bin/java
55-
JAVA_VERSION=$("$JAVA_CMD" -version 2>&1)
56-
if ! [[ "$JAVA_VERSION" =~ "1.6" ]]; then
57-
echo "***NOTE***: JAVA_HOME is not set to a JDK 6 installation. The resulting"
58-
echo " distribution will not support Java 6. See SPARK-1703."
59-
echo "Output from 'java -version' was:"
60-
echo "$JAVA_VERSION"
61-
fi
62-
63-
VERSION=$(mvn help:evaluate -Dexpression=project.version 2>/dev/null | grep -v "INFO" | tail -n 1)
64-
if [ $? != 0 ]; then
65-
echo -e "You need Maven installed to build Spark."
66-
echo -e "Download Maven from https://maven.apache.org/"
67-
exit -1;
68-
fi
69-
7049
# Initialize defaults
7150
SPARK_HADOOP_VERSION=1.0.4
7251
SPARK_YARN=false
@@ -88,6 +67,9 @@ while (( "$#" )); do
8867
--with-hive)
8968
SPARK_HIVE=true
9069
;;
70+
--skip-java-test)
71+
SKIP_JAVA_TEST=true
72+
;;
9173
--with-tachyon)
9274
SPARK_TACHYON=true
9375
;;
@@ -102,6 +84,34 @@ while (( "$#" )); do
10284
shift
10385
done
10486

87+
if [ -z "$JAVA_HOME" ]; then
88+
echo "Error: JAVA_HOME is not set, cannot proceed."
89+
exit -1
90+
fi
91+
92+
VERSION=$(mvn help:evaluate -Dexpression=project.version 2>/dev/null | grep -v "INFO" | tail -n 1)
93+
if [ $? != 0 ]; then
94+
echo -e "You need Maven installed to build Spark."
95+
echo -e "Download Maven from https://maven.apache.org/"
96+
exit -1;
97+
fi
98+
99+
JAVA_CMD="$JAVA_HOME"/bin/java
100+
JAVA_VERSION=$("$JAVA_CMD" -version 2>&1)
101+
if [[ ! "$JAVA_VERSION" =~ "1.6" && -z "$SKIP_JAVA_TEST" ]]; then
102+
echo "***NOTE***: JAVA_HOME is not set to a JDK 6 installation. The resulting"
103+
echo " distribution may not work well with PySpark and will not run"
104+
echo " with Java 6 (See SPARK-1703 and SPARK-1911)."
105+
echo " This test can be disabled by adding --skip-java-test."
106+
echo "Output from 'java -version' was:"
107+
echo "$JAVA_VERSION"
108+
read -p "Would you like to continue anyways? [y,n]: " -r
109+
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
110+
echo "Okay, exiting."
111+
exit 1
112+
fi
113+
fi
114+
105115
if [ "$NAME" == "none" ]; then
106116
NAME=$SPARK_HADOOP_VERSION
107117
fi

0 commit comments

Comments
 (0)