I need to plot my dataframe using WISP. I am using Apache Sprak in Scala. However it seems that it can not accept a dataframe.
+-----+--------------------+------------------+
|label| features| prediction|
+-----+--------------------+------------------+
| 101|[1.497846976E9,10...|101.22752534884378|
| 101|[1.497846976E9,10...|101.22752534884378|
| 101|[1.497846976E9,10...|101.22752534884378|
| 101|[1.497846976E9,10...|101.22752534884378|
| 101|[1.497846976E9,10...|101.22752534884378|
+-----+--------------------+------------------+
I also tried to change my datarame to Seq using the following code but, it does't work.
import org.apache.spark.sql.functions.{collect_list, collect_set}
val label=predictions.groupBy($"label").agg(collect_list($"label").alias("label"))
val predicted= predictions.groupBy($"prediction").agg(collect_list($"prediction").alias("prediction"))
line(predicted)
It shows me the following error:
Error:(157, 10) type mismatch;
found : org.apache.spark.sql.DataFrame
(which expands to) org.apache.spark.sql.Dataset[org.apache.spark.sql.Row]
required: com.quantifind.charts.repl.IterablePair[?,?,?,?]
line(predicted)
Is there any trick to plot a dataframe like below using WISP? Thanks in advance.
UPDATE:
According to answer number one, As I try to install vegas libraries, I got an error:
Error:Error while importing SBT project:<br/>...<br/><pre>[warn] ==== MapR Repository: tried
[warn] http://repository.mapr.com/maven/com/github/aishfenton/vegas-spark_2.10_2.11/0.2.0/vegas-spark_2.10_2.11-0.2.0.pom
[info] Resolving org.scala-lang#scala-compiler;2.11.8 ...
[info] Resolving org.scala-lang.modules#scala-xml_2.11;1.0.4 ...
[info] Resolving org.scala-lang.modules#scala-parser-combinators_2.11;1.0.4 ...
[info] Resolving jline#jline;2.12.1 ...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.github.aishfenton#vegas-spark_2.10_2.11;0.2.0: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Unresolved dependencies path:
[warn] com.github.aishfenton:vegas-spark_2.10_2.11:0.2.0 (/Users/saeedtkh/Desktop/ML_Alpha/build.sbt#L15-34)
[warn] +- ml:ml_2.11:1.0
[trace] Stack trace suppressed: run 'last *:ssExtractDependencies' for the full output.
[trace] Stack trace suppressed: run 'last *:update' for the full output.
[error] (*:ssExtractDependencies) sbt.ResolveException: unresolved dependency: com.github.aishfenton#vegas-spark_2.10_2.11;0.2.0: not found
[error] (*:update) sbt.ResolveException: unresolved dependency: com.github.aishfenton#vegas-spark_2.10_2.11;0.2.0: not found
[error] Total time: 27 s, completed Sep 22, 2017 1:06:23 PM</pre><br/>See complete log in file:/Users/saeedtkh/Library/Logs/IntelliJIdea2017.1/sbt.last.log
My bulid.sbt file is:
name := "ML"
version := "1.0"
scalaVersion := "2.11.8"
retrieveManaged := true
resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/"
resolvers += "MapR Repository" at "http://repository.mapr.com/maven/"
libraryDependencies ++= Seq(
"co.theasi" %% "plotly" % "0.2.0",
"org.apache.commons" % "commons-csv" % "1.1",
"org.apache.spark" %% "spark-core" % "2.0.2",
"org.apache.spark" %% "spark-core" % "2.0.2",
"org.apache.spark" %% "spark-sql" % "2.0.2",
"org.apache.spark" %% "spark-hive" % "2.0.2",
"org.apache.spark" %% "spark-streaming" % "2.0.2",
"org.apache.spark" %% "spark-mllib" % "2.0.2",
"org.apache.spark" %% "spark-mllib" % "2.0.2",
"org.scalanlp" %% "breeze" % "0.11.2",
"org.scalanlp" %% "breeze-natives" % "0.11.2",
"org.scalanlp" %% "breeze-viz" % "0.11.2",
"com.quantifind" %% "wisp" % "0.0.4"
// https://mvnrepository.com/artifact/com.github.aishfenton/vegas-spark_2.10
//"com.github.aishfenton" %% "vegas-spark_2.10" % "0.2.0"
)
What exactly are you trying to plot? Have you tried using Vegas? Vegas plotting library for Scala
An example for getting histograms of a dataframe column:
Add the following lines to your build file.
"org.vegas-viz" %% "vegas" % "0.3.9",
"org.vegas-viz" %% "vegas-spark" % "0.3.9"
An example code
import vegas._
import vegas.render.WindowRenderer._
import vegas.sparkExt._
val plot = Vegas("approval date").
withDataFrame(castedDf).
mark(Bar).
encodeX("columnName", Quant, bin=Bin(maxbins=20.0), sortOrder=SortOrder.Desc).
show
Related
I am starting to learn spark sql I am using the following dependencies in sbt. I am getting errors
name := "sparkLearning"
version := "1.0"
scalaVersion := "2.11.8"
val sparkVersion = "1.6.1"
val sqlVersion = "1.3.1"
libraryDependencies ++= Seq(
"org.apache.spark" %% "spark-core" % sparkVersion,
"org.apache.spark" % "spark-sql" % sqlVersion
)
I am getting an error.
Error:Error while importing SBT project:<br/>...<br/><pre>[info] Resolving com.thoughtworks.paranamer#paranamer;2.6 ...
[info] Resolving org.scala-sbt#completion;0.13.15 ...
[info] Resolving org.scala-sbt#control;0.13.15 ...
[info] Resolving org.scala-sbt#sbt;0.13.15 ...
[info] Resolving org.scala-sbt#run;0.13.15 ...
[info] Resolving org.scala-sbt.ivy#ivy;2.3.0-sbt-48dd0744422128446aee9ac31aa356ee203cc9f4 ...
[info] Resolving org.scala-sbt#test-interface;1.0 ...
[info] Resolving com.jcraft#jsch;0.1.50 ...
[info] Resolving org.scala-lang#scala-compiler;2.10.6 ...
[info] Resolving jline#jline;2.14.3 ...
[info] Resolving org.scala-sbt#compiler-ivy-integration;0.13.15 ...
[info] Resolving org.scala-sbt#incremental-compiler;0.13.15 ...
[info] Resolving org.scala-sbt#logic;0.13.15 ...
[info] Resolving org.scala-sbt#main-settings;0.13.15 ...
[trace] Stack trace suppressed: run 'last *:update' for the full output.
[trace] Stack trace suppressed: run 'last *:ssExtractDependencies' for the full output.
[error] (*:update) sbt.ResolveException: unresolved dependency: org.apache.spark#spark-sql;1.3.1: not found
[error] (*:ssExtractDependencies) sbt.ResolveException: unresolved dependency: org.apache.spark#spark-sql;1.3.1: not found
[error] Total time: 15 s, completed 27-Jul-2017 15:29:52
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=384M; support was removed in 8.0
Please let me know how to resolve this.
correct form for you sbt file is
name := "sparkLearning"
version := "1.0"
scalaVersion := "2.11.8"
val sparkVersion = "1.6.1"
libraryDependencies ++= Seq(
"org.apache.spark" % "spark-core_2.10" % sparkVersion,
"org.apache.spark" % "spark-sql_2.10" % sparkVersion
)
I would suggest you to use latest spark versions which should be compatible with scala 2.11.8
name := "sparkLearning"
version := "1.0"
scalaVersion := "2.11.8"
val sparkVersion = "2.2.0"
libraryDependencies ++= Seq(
"org.apache.spark" %% "spark-core" % sparkVersion,
"org.apache.spark" %% "spark-sql" % sparkVersion
)
I'm quite new to Scala, Akka and SBT, so this issue is giving me some headache! I'm working with the book Akka in Action, where the author provides examples on Github:
https://github.com/RayRoestenburg/akka-in-action
On a clean clone of the repository, i was trying to have a look at the example in chapter-cluster.
As described in the book, the first thing to do is to start a seed node on the local machine with:
sbt -DHOST=127.0.0.1 -DPORT=2551
I was trying to install another Scala version, run it with root privileges, but without success. In my understanding SBT should take care of all the versioning stuff and download the specified packages.
Error messages goes like that:
[info] Loading global plugins from /home/sfink/.sbt/0.13/plugins
[info] Loading project definition from /home/sfink/IdeaProjects/akka-in-action/chapter-cluster/project
[info] Updating {file:/home/sfink/IdeaProjects/akka-in-action/chapter-cluster/project/}chapter-cluster-build...
[info] Resolving org.scala-sbt#compiler-interface;0.13.1 ...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.scala-lang#scala-library;2.10.4: configuration not found in org.scala-lang#scala-library;2.10.4: 'master(compile)'. Missing configuration: 'compile'. It was required from org.scalactic#scalactic_2.10;2.2.1 compile
[warn] :: org.scala-lang#scala-reflect;2.10.4: configuration not found in org.scala-lang#scala-reflect;2.10.4: 'master(compile)'. Missing configuration: 'compile'. It was required from org.scalactic#scalactic_2.10;2.2.1 compile
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
sbt.ResolveException: unresolved dependency: org.scala-lang#scala-library;2.10.4: configuration not found in org.scala-lang#scala-library;2.10.4: 'master(compile)'. Missing configuration: 'compile'. It was required from org.scalactic#scalactic_2.10;2.2.1 compile
unresolved dependency: org.scala-lang#scala-reflect;2.10.4: configuration not found in org.scala-lang#scala-reflect;2.10.4: 'master(compile)'. Missing configuration: 'compile'. It was required from org.scalactic#scalactic_2.10;2.2.1 compile
at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:213)
at sbt.IvyActions$$anonfun$update$1.apply(IvyActions.scala:122)
at sbt.IvyActions$$anonfun$update$1.apply(IvyActions.scala:121)
at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:116)
at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:116)
at sbt.IvySbt$$anonfun$withIvy$1.apply(Ivy.scala:104)
at sbt.IvySbt.sbt$IvySbt$$action$1(Ivy.scala:51)
at sbt.IvySbt$$anon$3.call(Ivy.scala:60)
at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:98)
at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRetries$1(Locks.scala:81)
at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:102)
at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:102)
at xsbt.boot.Using$.withResource(Using.scala:11)
at xsbt.boot.Using$.apply(Using.scala:10)
at xsbt.boot.Locks$GlobalLock.withFileLock(Locks.scala:102)
at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:62)
at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:52)
at xsbt.boot.Locks$.apply0(Locks.scala:38)
at xsbt.boot.Locks$.apply(Locks.scala:28)
at sbt.IvySbt.withDefaultLogger(Ivy.scala:60)
at sbt.IvySbt.withIvy(Ivy.scala:101)
at sbt.IvySbt.withIvy(Ivy.scala:97)
at sbt.IvySbt$Module.withModule(Ivy.scala:116)
at sbt.IvyActions$.update(IvyActions.scala:121)
at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1161)
at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1159)
at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$73.apply(Defaults.scala:1182)
at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$73.apply(Defaults.scala:1180)
at sbt.Tracked$$anonfun$lastOutput$1.apply(Tracked.scala:35)
at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1184)
at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1179)
at sbt.Tracked$$anonfun$inputChanged$1.apply(Tracked.scala:45)
at sbt.Classpaths$.cachedUpdate(Defaults.scala:1187)
at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1152)
at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1130)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:42)
at sbt.std.Transform$$anon$4.work(System.scala:64)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
at sbt.Execute.work(Execute.scala:244)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)
[error] (*:update) sbt.ResolveException: unresolved dependency: org.scala-lang#scala-library;2.10.4: configuration not found in org.scala-lang#scala-library;2.10.4: 'master(compile)'. Missing configuration: 'compile'. It was required from org.scalactic#scalactic_2.10;2.2.1 compile
[error] unresolved dependency: org.scala-lang#scala-reflect;2.10.4: configuration not found in org.scala-lang#scala-reflect;2.10.4: 'master(compile)'. Missing configuration: 'compile'. It was required from org.scalactic#scalactic_2.10;2.2.1 compile
Update 1:
This is the content of the build.sbt file:
name := "words-cluster"
version := "1.0"
scalaVersion := "2.11.7"
organization := "com.manning"
libraryDependencies ++= {
val akkaVersion = "2.4.14"
Seq(
"com.typesafe.akka" %% "akka-actor" % akkaVersion,
"com.typesafe.akka" %% "akka-slf4j" % akkaVersion,
"com.typesafe.akka" %% "akka-remote" % akkaVersion,
"com.typesafe.akka" %% "akka-cluster" % akkaVersion,
"com.typesafe.akka" %% "akka-multi-node-testkit" % akkaVersion % "test",
"com.typesafe.akka" %% "akka-testkit" % akkaVersion % "test",
"org.scalatest" %% "scalatest" % "3.0.0" % "test",
"com.typesafe.akka" %% "akka-slf4j" % akkaVersion,
"ch.qos.logback" % "logback-classic" % "1.0.10"
)
}
// Assembly settings
mainClass in Global := Some("aia.cluster.words.Main")
assemblyJarName in assembly := "words-node.jar"
Any idea what is going wrong?
Try this as your build.sbt:
name := "words-cluster"
version := "1.0"
scalaVersion := "2.11.8"
organization := "com.manning"
libraryDependencies ++= {
val akkaVersion = "2.4.14"
Seq(
"com.typesafe.akka" %% "akka-actor" % akkaVersion,
"com.typesafe.akka" %% "akka-slf4j" % akkaVersion,
"com.typesafe.akka" %% "akka-remote" % akkaVersion,
"com.typesafe.akka" %% "akka-cluster" % akkaVersion,
"com.typesafe.akka" %% "akka-multi-node-testkit" % akkaVersion % "test",
"com.typesafe.akka" %% "akka-testkit" % akkaVersion % "test",
"org.scalatest" %% "scalatest" % "3.0.1" % "test" exclude("org.scala-lang.modules", "scala-xml_2.11"),
"com.typesafe.akka" %% "akka-slf4j" % akkaVersion,
"ch.qos.logback" % "logback-classic" % "1.1.7"
)
}
// Assembly settings
mainClass in Global := Some("aia.cluster.words.Main")
assemblyJarName in assembly := "words-node.jar"
I updated the scala, logging and scalatest versions
Seems like the sbt version i was using was the wrong one! After upgrading to sbt-0.13.15 compilation was running properly.
Thanks for helping!
After adding
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.0" % "test"
to build.sbt, and refreshed the project, I got this msg.
SBT project import
[warn] Multiple dependencies with the same organization/name but
different versions. To avoid conflict, pick one version:
[warn] * org.scala-lang.modules:scala-xml_2.11:(1.0.5, 1.0.4)
Changing the above to
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "3.0.0" % "test"
exclude("org.scala-lang", "scala-reflect")
exclude("org.scala-lang.modules", "scala-xml_2.11")
)
solves the issue. However, instead of excluding scala-xml_2.11 version 1.0.5 from scalatest, I would like to force the scala compiler to use scala-xml_2.11 version 1.0.5 instead of version 1.0.4. (I researched the versions at https://mvnrepository.com.) Thus I tried substituting scalaVersion := "2.11.8" for
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-reflect" % "2.11.8",
"org.scala-lang.modules" % "scala-xml_2.11" % "1.0.5"
)
This however results in
SBT project import
[warn] Binary version (2.11) for dependency
org.scala-lang#scala-reflect;2.11.8
[warn] in default#myproject$sources_javadoc_2.10;1.0 differs
from Scala binary version in project (2.10).
[warn] Binary version (2.11) for dependency
org.scala-lang#scala-library;2.11.8
[warn] in default#myproject$sources_javadoc_2.10;1.0 differs
from Scala binary version in project (2.10).
[warn] Multiple dependencies with the same organization/name but
different versions. To avoid conflict, pick one version:
[warn] * org.scala-lang:scala-library:(2.11.8, 2.10.4)
[warn] * org.scala-lang:scala-reflect:(2.11.8, 2.10.4)
[warn] [FAILED ]
com.artima.supersafe#supersafe_2.10.4;1.1.0!supersafe_2.10.4.jar(src):
(0ms)
[warn] ==== local: tried
[warn]
/home/user/.ivy2/local/com.artima.supersafe/supersafe_2.10.4/1.1.0/srcs/supersafe_2.10.4-sources.jar
[warn] ==== activator-local: tried [warn] /Development/Activator/activator-dist-1.3.10/repository/com.artima.supersafe/supersafe_2.1...
(show balloon)
What am I supposed to do?
Edit: What else I tried and did not work:
scalaVersion := "2.11.8"
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"org.scala-lang.modules" %% "scala-xml" % "1.0.5"
)
// ScalaTest
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.0" % "test"
[warn] Multiple dependencies with the same organization/name but
different versions. To avoid conflict, pick one version: [warn] *
org.scala-lang.modules:scala-xml_2.11:(1.0.5, 1.0.4)
scalaVersion := "2.11.8"
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"org.scala-lang.modules" %% "scala-xml_2.11" % "1.0.5"
)
// ScalaTest
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.0" % "test"
Error:Error while importing SBT project:...[info]
Resolving org.scala-sbt#run;0.13.8 ... [info] Resolving
org.scala-sbt#task-system;0.13.8 ... [info] Resolving
org.scala-sbt#tasks;0.13.8 ... [info] Resolving
org.scala-sbt#tracking;0.13.8 ... [info] Resolving
org.scala-sbt#cache;0.13.8 ... [info] Resolving
org.scala-sbt#testing;0.13.8 ... [info] Resolving
org.scala-sbt#test-agent;0.13.8 ... [info] Resolving
org.scala-sbt#test-interface;1.0 ... [info] Resolving
org.scala-sbt#main-settings;0.13.8 ... [info] Resolving
org.scala-sbt#apply-macro;0.13.8 ... [info] Resolving
org.scala-sbt#command;0.13.8 ... [info] Resolving
org.scala-sbt#logic;0.13.8 ... [info] Resolving
org.scala-sbt#precompiled-2_8_2;0.13.8 ... [info] Resolving
org.scala-sbt#precompiled-2_9_2;0.13.8 ... [info] Resolving
org.scala-sbt#precompiled-2_9_3;0.13.8 ... [trace] Stack trace
suppressed: run 'last *:update' for the full output. [trace] Stack
trace suppressed: run 'last :ssExtractDependencies' for the full
output. [error] (:update) sbt.ResolveException: unresolved
dependency: org.scala-lang.modules#scala-xml_2.11_2.11;1.0.5: not
found [error] (*:ssExtractDependencies) sbt.ResolveException:
unresolved dependency:
org.scala-lang.modules#scala-xml_2.11_2.11;1.0.5: not found [error]
Total time: 4 s, completed 01.10.2016 17:46:55
scalaVersion := "2.11.8"
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"org.scala-lang.modules" %% "scala-xml" % "1.0.5"
)
// ScalaTest
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "3.0.0" % "test"
exclude("org.scala-lang", "scala-reflect")
exclude("org.scala-lang.modules", "scala-xml")
)
[warn] Multiple dependencies with the same organization/name but
different versions. To avoid conflict, pick one version: [warn] *
org.scala-lang.modules:scala-xml_2.11:(1.0.5, 1.0.4)
My build.sbt
name := "MyProject"
version := "0.1.0"
scalaVersion := "2.11.8"
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"org.scala-lang.modules" %% "scala-xml" % "1.0.5"
)
// ScalaTest
//libraryDependencies += "org.scalactic" %% "scalactic" % "3.0.0"
//libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.0" % "test"
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "3.0.0" % "test"
exclude("org.scala-lang", "scala-reflect")
exclude("org.scala-lang.modules", "scala-xml_2.11")
)
The way to exclude specific transitive dependency is this:
Run sbt evicted to figure out which of the project dependencies is pulling in outdated library, let's assume the problematic library is: com.typesafe.slick.
Add the following exclude (the parentheses are important):
("com.typesafe" %% "slick" % "3.1.1").exclude("org.scala-lang.modules", "scala-xml_2.11")
Add this normally as you would be listing dependencies.
This will prevent sbt from including any version of scala-xml that was coming in as a transitive dependency of Slick.
Don't substitute; you need both scalaVersion and libraryDependencies.
Though use
scalaVersion := "2.11.8"
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"org.scala-lang.modules" %% "scala-xml" % "1.0.5"
)
to avoid bugs when you eventually change scalaVersion.
By removing scalaVersion you get default scalaVersion := "2.10.4" (with your version/settings of SBT, at least) but your libraryDependencies still require 2.11.
I'm having a little problem with these template from TypeSafe, when I try to import it in IntelliJ I get following message error:
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: io.spray#sbt-revolver;0.7.2: not found
[warn] :: com.typesafe.sbt#sbt-aspectj;0.10.1: not found
[warn] :: com.typesafe.sbteclipse#sbteclipse-plugin;2.5.0: not found
[warn] :: com.timushev.sbt#sbt-updates;0.1.7: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Some unresolved dependencies have extra attributes. Check that these dependencies exist with the requested attributes.
[warn] io.spray:sbt-revolver:0.7.2 (sbtVersion=0.13, scalaVersion=2.10)
[warn] com.typesafe.sbt:sbt-aspectj:0.10.1 (sbtVersion=0.13, scalaVersion=2.10)
[warn] com.typesafe.sbteclipse:sbteclipse-plugin:2.5.0 (sbtVersion=0.13, scalaVersion=2.10)
[warn] com.timushev.sbt:sbt-updates:0.1.7 (sbtVersion=0.13, scalaVersion=2.10)
[warn]
[warn] Note: Unresolved dependencies path:
[warn] io.spray:sbt-revolver:0.7.2 (sbtVersion=0.13, scalaVersion=2.10) (C:\Users\jlopesde\akka-spray-websocket\project\plugins.sbt#L1-2)
[warn] +- default:akka-spray-websocket-build:0.1-SNAPSHOT (sbtVersion=0.13, scalaVersion=2.10)
[warn] com.typesafe.sbt:sbt-aspectj:0.10.1 (sbtVersion=0.13, scalaVersion=2.10) (C:\Users\jlopesde\akka-spray-websocket\project\plugins.sbt#L3-4)
[warn] +- default:akka-spray-websocket-build:0.1-SNAPSHOT (sbtVersion=0.13, scalaVersion=2.10)
[warn] com.typesafe.sbteclipse:sbteclipse-plugin:2.5.0 (sbtVersion=0.13, scalaVersion=2.10) (C:\Users\jlopesde\akka-spray-websocket\project\plugins.sbt#L5-6)
[warn] +- default:akka-spray-websocket-build:0.1-SNAPSHOT (sbtVersion=0.13, scalaVersion=2.10)
[warn] com.timushev.sbt:sbt-updates:0.1.7 (sbtVersion=0.13, scalaVersion=2.10) (C:\Users\jlopesde\akka-spray-websocket\project\plugins.sbt#L7-8)
[warn] +- default:akka-spray-websocket-build:0.1-SNAPSHOT (sbtVersion=0.13, scalaVersion=2.10)
sbt.ResolveException: unresolved dependency: io.spray#sbt-revolver;0.7.2: not found
unresolved dependency: com.typesafe.sbt#sbt-aspectj;0.10.1: not found
unresolved dependency: com.typesafe.sbteclipse#sbteclipse-plugin;2.5.0: not found
unresolved dependency: com.timushev.sbt#sbt-updates;0.1.7: not found
[error] (*:update) sbt.ResolveException: unresolved dependency: io.spray#sbt-revolver;0.7.2: not found
[error] unresolved dependency: com.typesafe.sbt#sbt-aspectj;0.10.1: not found
[error] unresolved dependency: com.typesafe.sbteclipse#sbteclipse-plugin;2.5.0: not found
[error] unresolved dependency: com.timushev.sbt#sbt-updates;0.1.7: not found
I know there is a problem on importing it, probably versions of Spray or Scala aren't correct but I don't know how to fix it. Could you provide me some tips for dealing with problems like that?
Thanks
My build.sbt:
organization := "cua.li"
version := "0.4"
scalaVersion := "2.11.5"
libraryDependencies ++= {
val akkaV = "2.3.9"
val sprayV = "1.3.2"
val kamonV = "0.3.5"
Seq(
"com.wandoulabs.akka" %% "spray-websocket" % "0.1.4" withSources() withJavadoc,
"io.spray" %% "spray-json" % "1.3.1" withSources() withJavadoc,
"io.spray" %% "spray-can" % sprayV withSources() withJavadoc,
"io.spray" %% "spray-routing" % sprayV withSources() withJavadoc,
"com.typesafe.akka" %% "akka-actor" % akkaV withSources() withJavadoc,
"com.typesafe.akka" %% "akka-slf4j" % akkaV withSources() withJavadoc,
/*
"org.aspectj" % "aspectjweaver" % "1.8.4" withSources() withJavadoc,
"io.kamon" %% "kamon-core" % kamonV withSources() withJavadoc,
"io.kamon" %% "kamon-spray" % kamonV withSources() withJavadoc,
"io.kamon" %% "kamon-statsd" % kamonV withSources() withJavadoc,
"io.kamon" %% "kamon-log-reporter" % kamonV withSources() withJavadoc,
"io.kamon" %% "kamon-system-metrics" % kamonV withSources() withJavadoc,
"io.kamon" %% "kamon-testkit" % kamonV % "test" withSources() withJavadoc,
// */
"com.typesafe.akka" %% "akka-testkit" % akkaV % "test" withSources() withJavadoc,
"io.spray" %% "spray-testkit" % sprayV % "test" withSources() withJavadoc,
"org.scalatest" %% "scalatest" % "2.2.3" % "test",
"junit" % "junit" % "4.12" % "test",
"org.specs2" %% "specs2" % "2.4.15" % "test",
"ch.qos.logback" % "logback-classic" % "1.1.2"
)
}
scalacOptions ++= Seq("-deprecation", "-encoding", "UTF-8", "-feature", "-target:jvm-1.7", "-unchecked",
"-Ywarn-adapted-args", "-Ywarn-value-discard", "-Xlint")
javacOptions ++= Seq("-Xlint:deprecation", "-Xlint:unchecked", "-source", "1.7", "-target", "1.7", "-g:vars")
doc in Compile <<= target.map(_ / "none")
publishArtifact in (Compile, packageSrc) := false
logBuffered in Test := false
Keys.fork in Test := false
parallelExecution in Test := false
seq(Revolver.settings: _*)
import com.typesafe.sbt.SbtAspectj._
aspectjSettings
fork in run := true
javaOptions <++= AspectjKeys.weaverOptions in Aspectj
Probably missing the repositories to download the dependencies.
Try put this before libraryDependencies:
resolvers ++= Seq(
"Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/",
"Spray repository" at "http://repo.spray.io/",
"Scalaz Bintray Repo" at "http://dl.bintray.com/scalaz/releases"
)
I've had the same issue but only with sbt-revolver. I've managed to solve it by doing following:
My SBT is set up to use my Artifactory instance in order to retrieve dependencies.
1) In Artifactory I added the repository below to the "Remote Repositories" and made it part of the "remote-repos" virtual repository.
http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases
2) On my ~/.sbt/repositories file, I've made sure my Artifactory repository is configured with the correct URL format (please see below). I've taken the format from SBT's documentation.
artifactory-ivy: http://my.artifactory.com:8081/artifactory/repo/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
This is my Build.scala file. I am trying to import some com.google.api-ads library dependencies into my project and I keep getting error stating "Unresolved dependencies path". I can see these libraries being there in the maven repo though.
I have tried out various versions and also tried importing the google-http-client dependency which is a transitive dependency for the ads-lib and dfp-axis libraries.
object Build extends Build {
val commonSettings = Seq(
version := "1.0.0",
organization := "com.collective",
scalaVersion := "2.11.2",
scalacOptions ++= List(
"-encoding", "UTF-8",
"-target:jvm-1.7",
"-feature",
"-unchecked",
"-deprecation",
"-Xlint",
"-Xfatal-warnings"
)
)
val akkaV = "2.3.6"
val sprayV = "1.3.2"
val adsLibVersion = "1.30.0"
lazy val segmentFetcher = Project("segment-fetcher", file("."))
.settings(commonSettings: _*)
.settings(
name := "Segment Fetcher",
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-actor" % akkaV,
"com.typesafe.akka" %% "akka-testkit" % akkaV % "test",
"org.specs2" %% "specs2-core" % "2.3.11" % "test",
"io.spray" %% "spray-can" % sprayV,
"io.spray" %% "spray-client" % sprayV,
"io.spray" %% "spray-httpx" % sprayV,
"io.spray" %% "spray-routing" % sprayV,
"io.spray" %% "spray-testkit" % sprayV % "test"
"com.google.api-ads" %% "ads-lib" % adsLibVersion,
"com.google.api-ads" %% "ads-lib-axis" % adsLibVersion,
"com.google.api-ads" %% "dfp-axis" % adsLibVersion
)
)
}
When I run sbt compile, I get the unresolved dependencies error for the com.google.api-ads dependencies
> compile
[info] Updating {file:/Users/anand/IntellijProjects/segments-fetcher/}segment-fetcher...
[info] Resolving com.google.api-ads#ads-lib_2.11;1.30.0 ...
[warn] module not found: com.google.api-ads#ads-lib_2.11;1.30.0
[warn] ==== local: tried
[warn] /Users/anand/.ivy2/local/com.google.api-ads/ads-lib_2.11/1.30.0/ivys/ivy.xml
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/com/google/api-ads/ads-lib_2.11/1.30.0/ads-lib_2.11-1.30.0.pom
[info] Resolving com.google.api-ads#ads-lib-axis_2.11;1.30.0 ...
[warn] module not found: com.google.api-ads#ads-lib-axis_2.11;1.30.0
[warn] ==== local: tried
[warn] /Users/anand/.ivy2/local/com.google.api-ads/ads-lib-axis_2.11/1.30.0/ivys/ivy.xml
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/com/google/api-ads/ads-lib-axis_2.11/1.30.0/ads-lib-axis_2.11-1.30.0.pom
[info] Resolving com.google.api-ads#dfp-axis_2.11;1.30.0 ...
[warn] module not found: com.google.api-ads#dfp-axis_2.11;1.30.0
[warn] ==== local: tried
[warn] /Users/anand/.ivy2/local/com.google.api-ads/dfp-axis_2.11/1.30.0/ivys/ivy.xml
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/com/google/api-ads/dfp-axis_2.11/1.30.0/dfp-axis_2.11- 1.30.0.pom
[info] Resolving jline#jline;2.12 ...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.google.api-ads#ads-lib_2.11;1.30.0: not found
[warn] :: com.google.api-ads#ads-lib-axis_2.11;1.30.0: not found
[warn] :: com.google.api-ads#dfp-axis_2.11;1.30.0: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Unresolved dependencies path:
[warn] com.google.api-ads:ads-lib_2.11:1.30.0 (/Users/anand/IntellijProjects/segments- fetcher/project/Build.scala#L29)
[warn] +- com.collective:segment-fetcher_2.11:1.0.0
[warn] com.google.api-ads:ads-lib-axis_2.11:1.30.0 (/Users/anand/IntellijProjects/segments-fetcher/project/Build.scala#L29)
[warn] +- com.collective:segment-fetcher_2.11:1.0.0
[warn] com.google.api-ads:dfp-axis_2.11:1.30.0 (/Users/anand/IntellijProjects/segments-fetcher/project/Build.scala#L29)
[warn] +- com.collective:segment-fetcher_2.11:1.0.0
[trace] Stack trace suppressed: run last *:update for the full output.
[error] (*:update) sbt.ResolveException: unresolved dependency: com.google.api-ads#ads-lib_2.11;1.30.0: not found
[error] unresolved dependency: com.google.api-ads#ads-lib-axis_2.11;1.30.0: not found
[error] unresolved dependency: com.google.api-ads#dfp-axis_2.11;1.30.0: not found
[error] Total time: 5 s, completed 29 Oct, 2014 3:31:25 PM
%% is a special SBT operator that suffixes Scala version to artifact that is to be fetched from MAVEN. Try to replace %% with % for Java MAVEN dependencies (that Google is most probable are).
You might noticed that SBT tries to fetch artifact
com.google.api-ads#ads-lib_2.11;1.30.0
but should instead fetch (without 2.11 suffix)
com.google.api-ads#ads-lib;1.30.0