diff --git a/build/mvn b/build/mvn index a78b93a6856899fd0849c672eb286182df206da0..c3ab62da368685519aa70cc458c51c81d322319f 100755 --- a/build/mvn +++ b/build/mvn @@ -141,9 +141,13 @@ cd "${_CALLING_DIR}" # Now that zinc is ensured to be installed, check its status and, if its # not running or just installed, start it if [ -n "${ZINC_INSTALL_FLAG}" -o -z "`"${ZINC_BIN}" -status -port ${ZINC_PORT}`" ]; then + ZINC_JAVA_HOME= + if [ -n "$JAVA_7_HOME" ]; then + ZINC_JAVA_HOME="env JAVA_HOME=$JAVA_7_HOME" + fi export ZINC_OPTS=${ZINC_OPTS:-"$_COMPILE_JVM_OPTS"} "${ZINC_BIN}" -shutdown -port ${ZINC_PORT} - "${ZINC_BIN}" -start -port ${ZINC_PORT} \ + $ZINC_JAVA_HOME "${ZINC_BIN}" -start -port ${ZINC_PORT} \ -scala-compiler "${SCALA_COMPILER}" \ -scala-library "${SCALA_LIBRARY}" &>/dev/null fi diff --git a/external/java8-tests/pom.xml b/external/java8-tests/pom.xml index 60e3ff60df06559eebcc5ea5573befa1309bc0fc..74a3ee1ce11e2d42de66b400c386332543f5b83e 100644 --- a/external/java8-tests/pom.xml +++ b/external/java8-tests/pom.xml @@ -106,6 +106,7 @@ <groupId>net.alchim31.maven</groupId> <artifactId>scala-maven-plugin</artifactId> <configuration> + <useZincServer>${useZincForJdk8}</useZincServer> <javacArgs> <javacArg>-source</javacArg> <javacArg>1.8</javacArg> diff --git a/pom.xml b/pom.xml index fff5560afea2a8e03608d974cc5f27cb8d584724..60c8c8dc7a727ecb1eafeacc095c3cd0a12acb13 100644 --- a/pom.xml +++ b/pom.xml @@ -184,6 +184,9 @@ <test.java.home>${java.home}</test.java.home> <test.exclude.tags></test.exclude.tags> + <!-- When using different JDKs for the build, we can't use Zinc for the jdk8 part. --> + <useZincForJdk8>true</useZincForJdk8> + <!-- Package to use when relocating shaded classes. --> <spark.shade.packageName>org.spark_project</spark.shade.packageName> @@ -2576,6 +2579,42 @@ </properties> </profile> + <profile> + <id>java7</id> + <activation> + <property><name>env.JAVA_7_HOME</name></property> + </activation> + <properties> + <useZincForJdk8>false</useZincForJdk8> + </properties> + <build> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <compilerArgs combine.children="append"> + <arg>-bootclasspath</arg> + <arg>${env.JAVA_7_HOME}/jre/lib/rt.jar</arg> + </compilerArgs> + </configuration> + </plugin> + <plugin> + <groupId>net.alchim31.maven</groupId> + <artifactId>scala-maven-plugin</artifactId> + <configuration> + <args combine.children="append"> + <arg>-javabootclasspath</arg> + <arg>${env.JAVA_7_HOME}/jre/lib/rt.jar</arg> + </args> + </configuration> + </plugin> + </plugins> + </pluginManagement> + </build> + </profile> + <profile> <id>scala-2.11</id> <activation> diff --git a/project/SparkBuild.scala b/project/SparkBuild.scala index f08ca7001f34d999897461c39f6c79297a6c946b..744f57c5177a35cc2c5bdf0f5e48e49e972be4f7 100644 --- a/project/SparkBuild.scala +++ b/project/SparkBuild.scala @@ -277,12 +277,24 @@ object SparkBuild extends PomBuild { // additional discussion and explanation. javacOptions in (Compile, compile) ++= Seq( "-target", javacJVMVersion.value - ), + ) ++ sys.env.get("JAVA_7_HOME").toSeq.flatMap { jdk7 => + if (javacJVMVersion.value == "1.7") { + Seq("-bootclasspath", s"$jdk7/jre/lib/rt.jar") + } else { + Nil + } + }, scalacOptions in Compile ++= Seq( s"-target:jvm-${scalacJVMVersion.value}", "-sourcepath", (baseDirectory in ThisBuild).value.getAbsolutePath // Required for relative source links in scaladoc - ), + ) ++ sys.env.get("JAVA_7_HOME").toSeq.flatMap { jdk7 => + if (javacJVMVersion.value == "1.7") { + Seq("-javabootclasspath", s"$jdk7/jre/lib/rt.jar") + } else { + Nil + } + }, // Implements -Xfatal-warnings, ignoring deprecation warnings. // Code snippet taken from https://issues.scala-lang.org/browse/SI-8410.