aboutsummaryrefslogtreecommitdiff
path: root/pom.xml
diff options
context:
space:
mode:
authorMarcelo Vanzin <vanzin@cloudera.com>2016-05-31 16:54:34 -0700
committerMarcelo Vanzin <vanzin@cloudera.com>2016-05-31 16:54:34 -0700
commit57adb77e6b0208dc6d29488a674b6ad78702262f (patch)
tree2de7dfa2f3b62bccc3a8417d1fba69db5cecf24f /pom.xml
parent90b11439b3d4540f48985e87dcc99749f0369287 (diff)
downloadspark-57adb77e6b0208dc6d29488a674b6ad78702262f.tar.gz
spark-57adb77e6b0208dc6d29488a674b6ad78702262f.tar.bz2
spark-57adb77e6b0208dc6d29488a674b6ad78702262f.zip
[SPARK-15451][BUILD] Use jdk7's rt.jar when available.
This helps with preventing jdk8-specific calls being checked in, because PR builders are running the compiler with the wrong settings. If the JAVA_7_HOME env variable is set, assume it points at a jdk7 and use its rt.jar when invoking javac. For zinc, just run it with jdk7, and disable it when building jdk8-specific code. A big note for sbt usage: adding the bootstrap options forces sbt to fork the compiler, and that disables incremental compilation. That means that it's really not convenient to use for normal development, but should be ok for automated builds. Tested with JAVA_HOME=jdk8 and JAVA_7_HOME=jdk7: - mvn + zinc - mvn sans zinc - sbt Verified that in all cases, jdk8-specific library calls fail to compile. Author: Marcelo Vanzin <vanzin@cloudera.com> Closes #13272 from vanzin/SPARK-15451.
Diffstat (limited to 'pom.xml')
-rw-r--r--pom.xml39
1 files changed, 39 insertions, 0 deletions
diff --git a/pom.xml b/pom.xml
index fff5560afe..60c8c8dc7a 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>
@@ -2577,6 +2580,42 @@
</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>
<property><name>!scala-2.10</name></property>