Repository: spark
Updated Branches:
  refs/heads/branch-1.2 fc73171d5 -> 633d67cb7


[SPARK-4429][BUILD] Build for Scala 2.11 using sbt fails.

I tried to build for Scala 2.11 using sbt with the following command:

```
$ sbt/sbt -Dscala-2.11 assembly
```

but it ends with the following error messages:

```
[error] (streaming-kafka/*:update) sbt.ResolveException: unresolved dependency: 
org.apache.kafka#kafka_2.11;0.8.0: not found
[error] (catalyst/*:update) sbt.ResolveException: unresolved dependency: 
org.scalamacros#quasiquotes_2.11;2.0.1: not found
```

The reason is:
If system property `-Dscala-2.11` (without value) was set, `SparkBuild.scala` 
adds `scala-2.11` profile, but also `sbt-pom-reader` activates `scala-2.10` 
profile instead of `scala-2.11` profile because the activator 
`PropertyProfileActivator` used by `sbt-pom-reader` internally checks if the 
property value is empty or not.

The value is set to non-empty value, then no need to add profiles in 
`SparkBuild.scala` because `sbt-pom-reader` can handle as expected.

Author: Takuya UESHIN <ues...@happy-camper.st>

Closes #3342 from ueshin/issues/SPARK-4429 and squashes the following commits:

14d86e8 [Takuya UESHIN] Add a comment.
4eef52b [Takuya UESHIN] Remove unneeded condition.
ce98d0f [Takuya UESHIN] Set non-empty value to system property "scala-2.11" if 
the property exists instead of adding profile.

(cherry picked from commit f9adda9afb63bfdb722be95304f991a3b38a54b3)
Signed-off-by: Patrick Wendell <pwend...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/633d67cb
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/633d67cb
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/633d67cb

Branch: refs/heads/branch-1.2
Commit: 633d67cb73840225ec5deb5563de53e1f43532a5
Parents: fc73171
Author: Takuya UESHIN <ues...@happy-camper.st>
Authored: Wed Nov 19 14:40:21 2014 -0800
Committer: Patrick Wendell <pwend...@gmail.com>
Committed: Wed Nov 19 14:40:41 2014 -0800

----------------------------------------------------------------------
 project/SparkBuild.scala | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/633d67cb/project/SparkBuild.scala
----------------------------------------------------------------------
diff --git a/project/SparkBuild.scala b/project/SparkBuild.scala
index c1879ce..0cb2820 100644
--- a/project/SparkBuild.scala
+++ b/project/SparkBuild.scala
@@ -101,14 +101,13 @@ object SparkBuild extends PomBuild {
       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")
+    if (System.getProperty("scala-2.11") == "") {
+      // To activate scala-2.11 profile, replace empty property value to 
non-empty value
+      // in the same way as Maven which handles -Dname as -Dname=true before 
executes build process.
+      // see: 
https://github.com/apache/maven/blob/maven-3.0.4/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L1082
+      System.setProperty("scala-2.11", "true")
     }
+    profiles
   }
 
   Properties.envOrNone("SBT_MAVEN_PROPERTIES") match {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to