diff --git a/docs/building-spark.md b/docs/building-spark.md index 20ba7da5d71ff02ff8554f360d2c8952eb8f8435..bb18414092aae138d093cb5827cbae890900fb42 100644 --- a/docs/building-spark.md +++ b/docs/building-spark.md @@ -113,9 +113,9 @@ mvn -Pyarn -Phive -Phive-thriftserver-0.12.0 -Phadoop-2.4 -Dhadoop.version=2.4.0 {% endhighlight %} # Building for Scala 2.11 -To produce a Spark package compiled with Scala 2.11, use the `-Pscala-2.11` profile: +To produce a Spark package compiled with Scala 2.11, use the `-Dscala-2.11` property: - mvn -Pyarn -Phadoop-2.4 -Pscala-2.11 -DskipTests clean package + mvn -Pyarn -Phadoop-2.4 -Dscala-2.11 -DskipTests clean package Scala 2.11 support in Spark is experimental and does not support a few features. Specifically, Spark's external Kafka library and JDBC component are not yet diff --git a/examples/pom.xml b/examples/pom.xml index 2ec5728154abf91006fffd368745cc1b8effce4c..2752ce3ca9821ab7d148917132ba6b86e5b31ced 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -389,11 +389,11 @@ </properties> </profile> <profile> - <!-- We add source directories specific to Scala 2.10 and 2.11 since some examples - work only in one and not the other --> + <!-- We add a source directory specific to Scala 2.10 since Kafka and Algebird + only work with it --> <id>scala-2.10</id> <activation> - <activeByDefault>true</activeByDefault> + <property><name>!scala-2.11</name></property> </activation> <dependencies> <dependency> @@ -427,65 +427,6 @@ </sources> </configuration> </execution> - <execution> - <id>add-scala-test-sources</id> - <phase>generate-test-sources</phase> - <goals> - <goal>add-test-source</goal> - </goals> - <configuration> - <sources> - <source>src/test/scala</source> - <source>scala-2.10/src/test/scala</source> - <source>scala-2.10/src/test/java</source> - </sources> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> - <profile> - <id>scala-2.11</id> - <activation> - <activeByDefault>false</activeByDefault> - </activation> - <dependencies> - <!-- Streaming Kafka and zeromq modules are disabled for now. --> - </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>build-helper-maven-plugin</artifactId> - <executions> - <execution> - <id>add-scala-sources</id> - <phase>generate-sources</phase> - <goals> - <goal>add-source</goal> - </goals> - <configuration> - <sources> - <source>src/main/scala</source> - <source>scala-2.11/src/main/scala</source> - </sources> - </configuration> - </execution> - <execution> - <id>add-scala-test-sources</id> - <phase>generate-test-sources</phase> - <goals> - <goal>add-test-source</goal> - </goals> - <configuration> - <sources> - <source>src/test/scala</source> - <source>scala-2.11/src/test/scala</source> - </sources> - </configuration> - </execution> </executions> </plugin> </plugins> diff --git a/pom.xml b/pom.xml index 7bbde31e572d9f2d058d49f2b1d1bd72d351bcb4..90d3bff76bbbc0c0a1b6136e905d293b5370e4bf 100644 --- a/pom.xml +++ b/pom.xml @@ -1296,9 +1296,6 @@ <profile> <id>mapr3</id> - <activation> - <activeByDefault>false</activeByDefault> - </activation> <properties> <hadoop.version>1.0.3-mapr-3.0.3</hadoop.version> <yarn.version>2.3.0-mapr-4.0.0-FCS</yarn.version> @@ -1309,9 +1306,6 @@ <profile> <id>mapr4</id> - <activation> - <activeByDefault>false</activeByDefault> - </activation> <properties> <hadoop.version>2.3.0-mapr-4.0.0-FCS</hadoop.version> <yarn.version>2.3.0-mapr-4.0.0-FCS</yarn.version> @@ -1341,9 +1335,6 @@ <!-- Build without Hadoop dependencies that are included in some runtime environments. --> <profile> <id>hadoop-provided</id> - <activation> - <activeByDefault>false</activeByDefault> - </activation> <dependencies> <dependency> <groupId>org.apache.hadoop</groupId> @@ -1390,18 +1381,12 @@ </profile> <profile> <id>hive-thriftserver</id> - <activation> - <activeByDefault>false</activeByDefault> - </activation> <modules> <module>sql/hive-thriftserver</module> </modules> </profile> <profile> <id>hive-0.12.0</id> - <activation> - <activeByDefault>false</activeByDefault> - </activation> <properties> <hive.version>0.12.0-protobuf-2.5</hive.version> <hive.version.short>0.12.0</hive.version.short> @@ -1410,9 +1395,6 @@ </profile> <profile> <id>hive-0.13.1</id> - <activation> - <activeByDefault>false</activeByDefault> - </activation> <properties> <hive.version>0.13.1a</hive.version> <hive.version.short>0.13.1</hive.version.short> @@ -1423,7 +1405,7 @@ <profile> <id>scala-2.10</id> <activation> - <activeByDefault>true</activeByDefault> + <property><name>!scala-2.11</name></property> </activation> <properties> <scala.version>2.10.4</scala.version> @@ -1439,7 +1421,7 @@ <profile> <id>scala-2.11</id> <activation> - <activeByDefault>false</activeByDefault> + <property><name>scala-2.11</name></property> </activation> <properties> <scala.version>2.11.2</scala.version> diff --git a/project/SparkBuild.scala b/project/SparkBuild.scala index d95d50a1d8124b5da7c9e194386fe483b449e8e4..c96a6c49545c119e4391c5f8307eb9320a51e8dc 100644 --- a/project/SparkBuild.scala +++ b/project/SparkBuild.scala @@ -100,8 +100,11 @@ object SparkBuild extends PomBuild { "conjunction with environment variable.") v.split("(\\s+|,)").filterNot(_.isEmpty).map(_.trim.replaceAll("-P", "")).toSeq } + if (profiles.exists(_.contains("scala-"))) { profiles + } else if (System.getProperty("scala-2.11") != null) { + profiles ++ Seq("scala-2.11") } else { println("Enabled default scala profile") profiles ++ Seq("scala-2.10") diff --git a/repl/pom.xml b/repl/pom.xml index bd688c8c1e752908e3c3e5c16e65482003439bd6..c2bf9fdfbcce705d68559e9a2dc1c93d921c8302 100644 --- a/repl/pom.xml +++ b/repl/pom.xml @@ -35,6 +35,8 @@ <sbt.project.name>repl</sbt.project.name> <deb.install.path>/usr/share/spark</deb.install.path> <deb.user>root</deb.user> + <extra.source.dir>scala-2.10/src/main/scala</extra.source.dir> + <extra.testsource.dir>scala-2.10/src/test/scala</extra.testsource.dir> </properties> <dependencies> @@ -122,86 +124,51 @@ </environmentVariables> </configuration> </plugin> + <!-- Include a source dir depending on the Scala version --> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <executions> + <execution> + <id>add-scala-sources</id> + <phase>generate-sources</phase> + <goals> + <goal>add-source</goal> + </goals> + <configuration> + <sources> + <source>src/main/scala</source> + <source>${extra.source.dir}</source> + </sources> + </configuration> + </execution> + <execution> + <id>add-scala-test-sources</id> + <phase>generate-test-sources</phase> + <goals> + <goal>add-test-source</goal> + </goals> + <configuration> + <sources> + <source>src/test/scala</source> + <source>${extra.testsource.dir}</source> + </sources> + </configuration> + </execution> + </executions> + </plugin> </plugins> </build> <profiles> - <profile> - <id>scala-2.10</id> - <build> - <plugins> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>build-helper-maven-plugin</artifactId> - <executions> - <execution> - <id>add-scala-sources</id> - <phase>generate-sources</phase> - <goals> - <goal>add-source</goal> - </goals> - <configuration> - <sources> - <source>src/main/scala</source> - <source>scala-2.10/src/main/scala</source> - </sources> - </configuration> - </execution> - <execution> - <id>add-scala-test-sources</id> - <phase>generate-test-sources</phase> - <goals> - <goal>add-test-source</goal> - </goals> - <configuration> - <sources> - <source>src/test/scala</source> - <source>scala-2.10/src/test/scala</source> - </sources> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> <profile> <id>scala-2.11</id> - <build> - <plugins> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>build-helper-maven-plugin</artifactId> - <executions> - <execution> - <id>add-scala-sources</id> - <phase>generate-sources</phase> - <goals> - <goal>add-source</goal> - </goals> - <configuration> - <sources> - <source>src/main/scala</source> - <source>scala-2.11/src/main/scala</source> - </sources> - </configuration> - </execution> - <execution> - <id>add-scala-test-sources</id> - <phase>generate-test-sources</phase> - <goals> - <goal>add-test-source</goal> - </goals> - <configuration> - <sources> - <source>src/test/scala</source> - <source>scala-2.11/src/test/scala</source> - </sources> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> + <activation> + <property><name>scala-2.11</name></property> + </activation> + <properties> + <extra.source.dir>scala-2.11/src/main/scala</extra.source.dir> + <extra.testsource.dir>scala-2.11/src/test/scala</extra.testsource.dir> + </properties> </profile> </profiles> </project> diff --git a/sql/catalyst/pom.xml b/sql/catalyst/pom.xml index 0cc3175b6a2a204c59c7f69a0fc72be1eb7e0e05..686d189d810a85502e1b0410ba2afc1453640352 100644 --- a/sql/catalyst/pom.xml +++ b/sql/catalyst/pom.xml @@ -100,10 +100,11 @@ </plugins> </build> <profiles> + <!-- Quasiquotes are merged into scala reflect from scala 2.11 onwards. --> <profile> <id>scala-2.10</id> <activation> - <activeByDefault>true</activeByDefault> + <property><name>!scala-2.11</name></property> </activation> <dependencies> <dependency> @@ -113,13 +114,5 @@ </dependency> </dependencies> </profile> - <profile> - <id>scala-2.11</id> - <activation> - <activeByDefault>false</activeByDefault> - </activation> - <!-- Quasiquotes are merged into scala reflect from scala 2.11 onwards. --> - </profile> - </profiles> </project> diff --git a/sql/hive/pom.xml b/sql/hive/pom.xml index 67e36a951e5068f2be50e2673113aa7e23ece901..fa9a1e64b0f8038912ffd42b6395a32267d84683 100644 --- a/sql/hive/pom.xml +++ b/sql/hive/pom.xml @@ -144,9 +144,6 @@ </profile> <profile> <id>hive-0.12.0</id> - <activation> - <activeByDefault>false</activeByDefault> - </activation> <dependencies> <dependency> <groupId>com.twitter</groupId>