Unresolved dependencies path SBT - Scala Intellij Project - scala

I have have newly installed and created spark, scala, SBT development environment in intellij but when i am trying to compile SBT, getting unresolved dependencies error.
below is my SBT file
name := "xxxxxxxxxxxxxxxxxxxx"
version := "0.1"
scalaVersion := "2.11.8"
val sparkVersion = "2.3.1"
val jacksonCore = "2.6.7"
val publishMavenStyle = true
resolvers ++= Seq(
"Artifactory" at "https://binrepo.xxxxxx.com/artifactory/xyz/",
"Artifactory Common" at "https://binrepo.xxxxxx.com/artifactory/data-engineering-gscl-abc/",
//"ArtifactorySnapShots" at "https://binrepo.xxxxxx.com/artifactory/xyz/SNAPSHOTS/"
("Spark Packages Repo" at "http://dl.bintray.com/spark-packages/maven").withAllowInsecureProtocol(true)
)
libraryDependencies ++= Seq(
"org.scalamock" %% "scalamock" % "4.4.0" % Test,
//dependency of xyz-core.
"com.tgt.dsc.xyz.datapipeline" % "xyz-core_2.11" % "1.8.1",
//dependency of fields performance specific common function
"abc-common" % "abc-common_2.11" % "3.0.0",
//dependency of reading configuration
"com.typesafe" % "config" % "1.3.3",
//spark core libraries, in the production or for spark-submit in local add provided so that dependent jar is not part of assembly jar
// ex :"org.apache.spark" %% "spark-core" % sparkVersion % provided,
"org.apache.spark" %% "spark-core" % sparkVersion % Provided ,
"org.apache.spark" %% "spark-sql" % sparkVersion % Provided ,
"org.apache.spark" %% "spark-hive" % sparkVersion % Provided ,
"org.scala-lang" % "scala-library" % scalaVersion.value,
//logging library
"org.slf4j" % "slf4j-api" % "1.7.29",
//for doing testing
"org.scalatest" %% "scalatest" % "3.1.0" % Test,
"MrPowers" % "spark-fast-tests" % "0.20.0-s_2.11",
"mrpowers" % "spark-daria" % "0.35.0-s_2.11"
)
enablePlugins(GitVersioning)
assemblyJarName in assembly := s"${name.value}_${scalaVersion.value}-${version.value}.jar"
assemblyMergeStrategy in assembly := {
//case "META-INF/services/org.apache.spark.sql.sources.DataSourceRegister" => MergeStrategy.concat
case PathList("META-INF", xs#_*) => MergeStrategy.discard
case x => MergeStrategy.first
}
//get the token from secrets
val token = sys.env.getOrElse("SONAR_TOKEN", "")
//configurations for sonar integration
sonarProperties ++= Map(
"sonar.host.url" -> "http://sonarqube.xxxxxx.com:9000",
"sonar.scala.version" -> "2.11",
"sonar.projectName" -> "xyz-starter",
"sonar.projectKey" -> "xyz-starter",
"sonar.sources" -> "src/main/scala",
"sonar.tests" -> "src/test/scala",
"sonar.scala.coverage.reportPaths" -> "xxxxxx/scala-2.11/coverage-report/cobertura.xml,xxxxxx/scala-2.11/scapegoat-report/scapegoat.xml",
"sonar.login" -> token,
"sonar.buildbreaker.skip" -> "false"
)
//how much code coverage is needed
coverageMinimum := 80
//fail the build if code coverage is not met
coverageFailOnMinimum := true
Entire sbt file is showing in red including the name, version, scalaVersion
when i compile following is the error which i am getting now
/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/bin/java -Djline.terminal=jline.UnsupportedTerminal -Dsbt.log.noformat=true -Dfile.encoding=UTF-8 -Didea.managed=true -Dfile.encoding=UTF-8 -jar /Users/xxxxxxx/Library/Application Support/JetBrains/IdeaIC2020.2/plugins/Scala/launcher/sbt-launch.jar
[info] welcome to sbt 1.4.5 (AdoptOpenJDK Java 11.0.9)
[info] loading global plugins from /Users/xxxxxxx/.sbt/1.0/plugins
[info] loading settings for project xxxxxxxxxxxxxxxxxxxxxxxxxx-build from assembly.sbt ...
[info] loading project definition from /Users/xxxxxxx/Documents/GitClone/xxxxxxxxxxxxxxxxxxxxxxxxxx/project
[warn] There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings.
[info] loading settings for project xxxxxxxxxxxxxxxxxxxxxxxxxx from build.sbt ...
[info] set current project to xxxxxxxxxxxxxxxxxxxxxxxxxx (in build file:/Users/xxxxxxx/Documents/GitClone/xxxxxxxxxxxxxxxxxxxxxxxxxx/)
[info] sbt server started at local:///Users/xxxxxxx/.sbt/1.0/server/5231834612cf96406db7/sock
[info] started sbt server
sbt:xxxxxxxxxxxxxxxxxxxxxxxxxx>
;set _root_.scala.collection.Seq(historyPath := None,shellPrompt := { _ => "" }
,SettingKey[_root_.scala.Option[_root_.sbt.File]]("sbtStructureOutputFile")
in _root_.sbt.Global := _root_.scala.Some(_root_.sbt.file("/private/var/folders/6p/qvsthwj11q38nxlpn72hv6fr0000gq/T/sbt-structure.xml"))
,SettingKey[_root_.java.lang.String]
("sbtStructureOptions")
in _root_.sbt.Global := "download, resolveClassifiers")
[info] Defining Global / sbtStructureOptions, Global / sbtStructureOutputFile and 1 others.
[info] The new values will be used by cleanKeepGlobs
[info] Run `last` for details.
[info] Reapplying settings...
[info] set current project to xxxxxxxxxxxxxxxxxxxxxxxxxx (in build file:/Users/xxxxxxx/Documents/GitClone/xxxxxxxxxxxxxxxxxxxxxxxxxx/)
[info] Applying State transformations org.jetbrains.sbt.CreateTasks from /Users/xxxxxxx/Library/Application Support/JetBrains/IdeaIC2020.2/plugins/Scala/repo/org.jetbrains/sbt-structure-extractor/scala_2.12/sbt_1.0/2018.2.1+4-88400d3f/jars/sbt-structure-extractor.jar
[info] Reapplying settings...
[info] set current project to xxxxxxxxxxxxxxxxxxxxxxxxxx (in build file:/Users/xxxxxxx/Documents/GitClone/xxxxxxxxxxxxxxxxxxxxxxxxxx/)
[warn]
[warn] Note: Unresolved dependencies path:
[error] stack trace is suppressed; run 'last update' for the full output
[error] stack trace is suppressed; run 'last ssExtractDependencies' for the full output
[error] (update) sbt.librarymanagement.ResolveException: Error downloading MrPowers:spark-fast-tests:0.20.0-s_2.11
[error] Not found
[error] Not found
[error] not found: /Users/xxxxxxx/.ivy2/localMrPowers/spark-fast-tests/0.20.0-s_2.11/ivys/ivy.xml
[error] not found: https://repo1.maven.org/maven2/MrPowers/spark-fast-tests/0.20.0-s_2.11/spark-fast-tests-0.20.0-s_2.11.pom
[error] not found: https://binrepo.target.com/artifactory/kelsa/MrPowers/spark-fast-tests/0.20.0-s_2.11/spark-fast-tests-0.20.0-s_2.11.pom
[error] not found: https://binrepo.target.com/artifactory/data-engineering-gscl-fieldperformance/MrPowers/spark-fast-tests/0.20.0-s_2.11/spark-fast-tests-0.20.0-s_2.11.pom
[error] download error: Caught java.io.IOException: Server returned HTTP response code: 403 for URL: http://dl.bintray.com/spark-packages/maven/MrPowers/spark-fast-tests/0.20.0-s_2.11/spark-fast-tests-0.20.0-s_2.11.pom (Server returned HTTP response code: 403 for URL: http://dl.bintray.com/spark-packages/maven/MrPowers/spark-fast-tests/0.20.0-s_2.11/spark-fast-tests-0.20.0-s_2.11.pom) while downloading http://dl.bintray.com/spark-packages/maven/MrPowers/spark-fast-tests/0.20.0-s_2.11/spark-fast-tests-0.20.0-s_2.11.pom
[error] Error downloading mrpowers:spark-daria:0.35.0-s_2.11
[error] Not found
[error] Not found
[error] not found: /Users/xxxxxxx/.ivy2/localmrpowers/spark-daria/0.35.0-s_2.11/ivys/ivy.xml
[error] not found: https://repo1.maven.org/maven2/mrpowers/spark-daria/0.35.0-s_2.11/spark-daria-0.35.0-s_2.11.pom
[error] not found: https://binrepo.target.com/artifactory/kelsa/mrpowers/spark-daria/0.35.0-s_2.11/spark-daria-0.35.0-s_2.11.pom
[error] not found: https://binrepo.target.com/artifactory/data-engineering-gscl-fieldperformance/mrpowers/spark-daria/0.35.0-s_2.11/spark-daria-0.35.0-s_2.11.pom
[error] download error: Caught java.io.IOException: Server returned HTTP response code: 403 for URL: http://dl.bintray.com/spark-packages/maven/mrpowers/spark-daria/0.35.0-s_2.11/spark-daria-0.35.0-s_2.11.pom (Server returned HTTP response code: 403 for URL: http://dl.bintray.com/spark-packages/maven/mrpowers/spark-daria/0.35.0-s_2.11/spark-daria-0.35.0-s_2.11.pom) while downloading http://dl.bintray.com/spark-packages/maven/mrpowers/spark-daria/0.35.0-s_2.11/spark-daria-0.35.0-s_2.11.pom
[error] (ssExtractDependencies) sbt.librarymanagement.ResolveException: Error downloading MrPowers:spark-fast-tests:0.20.0-s_2.11
[error] Not found
[error] Not found
[error] not found: /Users/xxxxxxx/.ivy2/localMrPowers/spark-fast-tests/0.20.0-s_2.11/ivys/ivy.xml
[error] not found: https://repo1.maven.org/maven2/MrPowers/spark-fast-tests/0.20.0-s_2.11/spark-fast-tests-0.20.0-s_2.11.pom
[error] not found: https://binrepo.target.com/artifactory/kelsa/MrPowers/spark-fast-tests/0.20.0-s_2.11/spark-fast-tests-0.20.0-s_2.11.pom
[error] not found: https://binrepo.target.com/artifactory/data-engineering-gscl-fieldperformance/MrPowers/spark-fast-tests/0.20.0-s_2.11/spark-fast-tests-0.20.0-s_2.11.pom
[error] download error: Caught java.io.IOException: Server returned HTTP response code: 403 for URL: http://dl.bintray.com/spark-packages/maven/MrPowers/spark-fast-tests/0.20.0-s_2.11/spark-fast-tests-0.20.0-s_2.11.pom (Server returned HTTP response code: 403 for URL: http://dl.bintray.com/spark-packages/maven/MrPowers/spark-fast-tests/0.20.0-s_2.11/spark-fast-tests-0.20.0-s_2.11.pom) while downloading http://dl.bintray.com/spark-packages/maven/MrPowers/spark-fast-tests/0.20.0-s_2.11/spark-fast-tests-0.20.0-s_2.11.pom
[error] Error downloading mrpowers:spark-daria:0.35.0-s_2.11
[error] Not found
[error] Not found
[error] not found: /Users/xxxxxxx/.ivy2/localmrpowers/spark-daria/0.35.0-s_2.11/ivys/ivy.xml
[error] not found: https://repo1.maven.org/maven2/mrpowers/spark-daria/0.35.0-s_2.11/spark-daria-0.35.0-s_2.11.pom
[error] not found: https://binrepo.target.com/artifactory/kelsa/mrpowers/spark-daria/0.35.0-s_2.11/spark-daria-0.35.0-s_2.11.pom
[error] not found: https://binrepo.target.com/artifactory/data-engineering-gscl-fieldperformance/mrpowers/spark-daria/0.35.0-s_2.11/spark-daria-0.35.0-s_2.11.pom
[error] download error: Caught java.io.IOException: Server returned HTTP response code: 403 for URL: http://dl.bintray.com/spark-packages/maven/mrpowers/spark-daria/0.35.0-s_2.11/spark-daria-0.35.0-s_2.11.pom (Server returned HTTP response code: 403 for URL: http://dl.bintray.com/spark-packages/maven/mrpowers/spark-daria/0.35.0-s_2.11/spark-daria-0.35.0-s_2.11.pom) while downloading http://dl.bintray.com/spark-packages/maven/mrpowers/spark-daria/0.35.0-s_2.11/spark-daria-0.35.0-s_2.11.pom
[error] Total time: 7 s, completed 19-May-2021, 6:44:44 PM
[info] shutting down sbt server
Any idea on how to resolve it.
Adding the Screenshot of how my console looks

Entire sbt file is showing in red including the name, version, scalaVersion
This is likely caused by some missing configuration in IntelliJ, you should have some kind of popup that aks you to "configure Scala SDK". If not, you can go to your module settings and add the Scala SDK.
when i compile following is the error which i am getting now
If you look closely to the error, you should notice this message:
Server returned HTTP response code: 403 for URL: http://dl.bintray.com/spark-packages/maven/MrPowers/spark-fast-tests/0.20.0-s_2.11/spark-fast-tests-0.20.0-s_2.11.pom
The dependencies you are looking for ("MrPowers" % "spark-fast-tests" % "0.20.0-s_2.11" and "mrpowers" % "spark-daria" % "0.35.0-s_2.11") are only available in this repository http://dl.bintray.com/spark-packages/maven/ which seems to require some authentication as the HTTP error code 403 suggests.
Either you can configure authentication, or you can use more recent versions of these libraries that are published on the public Maven central repository:
"com.github.mrpowers" %% "spark-daria" % "0.39.0"
"com.github.mrpowers" %% "spark-fast-tests" % "0.23.0"
EDIT: how did I find that? I used https://mvnrepository.com/search?q=spark-daria to search for your dependencies and found the new ones with the Repository Central flag
Also note there are few things that you may want to change in your build.sbt:
Use the "sbt scheme" to use Scala dependencies without manually setting the Scala version:
use "com.github.mrpowers" %% "spark-daria" % "0.39.0"
instead of "com.github.mrpowers" % "spark-daria" % "0.39.0_2.11" (notice the double %% and the absence of suffix _2.11)
Do not declare the Scala library dependency "org.scala-lang" % "scala-library" % scalaVersion.value, this is implicitly provided

The Issue was related to the missing dependency i.e.
"MrPowers" % "spark-fast-tests" % "0.20.0-s_2.11",
"mrpowers" % "spark-daria" % "0.35.0-s_2.11"
After removing this from the code I found that it was also being used in the other dependent JAR
//dependency of fields performance specific common function
"abc-common" % "abc-common_2.11" % "3.0.0",
Removing from there solved the issue.

Related

Scala SBT is not able to download dependencies

I am new to scala and Akka. I have created a new project and below is my build.sbt file.
name := "akka_essentials"
version := "0.1"
scalaVersion := "2.13.4"
val akkaVersion = "2.5.13"
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-actor" % akkaVersion,
"com.typesafe.akka" %% "akka-testkit" % akkaVersion,
"com.scalatest" %% "scalatest" % "3.0.5"
)
The sbt tool is not able to download dependencies. The error log is as below:
[error] stack trace is suppressed; run 'last update' for the full output
[error] (update) sbt.librarymanagement.ResolveException: Error downloading com.typesafe.akka:akka-testkit_2.13:2.5.13
[error] Not found
[error] Not found
[error] not found: C:\Users\Anand\.ivy2\local\com.typesafe.akka\akka-testkit_2.13\2.5.13\ivys\ivy.xml
[error] not found: https://repo1.maven.org/maven2/com/typesafe/akka/akka-testkit_2.13/2.5.13/akka-testkit_2.13-2.5.13.pom
[error] Error downloading com.scalatest:scalatest_2.13:3.0.5
[error] Not found
[error] Not found
[error] not found: C:\Users\Anand\.ivy2\local\com.scalatest\scalatest_2.13\3.0.5\ivys\ivy.xml
[error] not found: https://repo1.maven.org/maven2/com/scalatest/scalatest_2.13/3.0.5/scalatest_2.13-3.0.5.pom
[error] Error downloading com.typesafe.akka:akka-actor_2.13:2.5.13
[error] Not found
[error] Not found
[error] not found: C:\Users\Anand\.ivy2\local\com.typesafe.akka\akka-actor_2.13\2.5.13\ivys\ivy.xml
[error] not found: https://repo1.maven.org/maven2/com/typesafe/akka/akka-actor_2.13/2.5.13/akka-actor_2.13-2.5.13.pom
I am very new to scala. I have not defined anything like ivy.xml. I am from java background and generally use gradle.
Please advise to resolve this.
Akka 2.5.13 has not been cross published for Scala 2.13 as you can check on Maven.
The earliest version supporting 2.13 (release, not milestone or RC) is 2.5.23. You can see the version matrix for Actors here.
So you need to use newer Akka or older Scala.
With Scalatest you used wrong organization. It's "org.scalatest" not "com.scalatest".
If you have doubts about dependency resoultion check Maven first.
I did the following changes to make it work:
name := "project"
version := "0.1"
scalaVersion := "2.12.7"
val akkaVersion = "2.5.13"
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-actor" % akkaVersion,
"com.typesafe.akka" %% "akka-testkit" % akkaVersion
// "com.scalatest" %% "scalatest" % "3.0.5"
)

extracting project for sbt

I've been getting the below error quite a lot recently. It happens when I try to add library dependencies to sbt. In the below instance I tried to add
"org.tpolecat" %% "doobie-postgres" % "0.8.8",
"org.tpolecat" %% "doobie-postgres-circe" % "0.8.8",
I'm using Java 1.8 SDK and scala-sdk-2.13.3
I recently got a new macbook and downloaded IntelliJ perhaps I haven't set it up right. I also tried changing the version number of all doobie dependencies to 0.8.8 but that didn't help either.
name := "job-board"
version := "1.0"
scalaVersion := "2.11.7"
libraryDependencies ++= {
lazy val doobieVersion = "0.5.4"
lazy val http4sVersion = "0.20.8"
lazy val circeVersion = "0.9.1"
Seq(
"org.tpolecat" %% "doobie-postgres" % "0.8.8",
"org.tpolecat" %% "doobie-postgres-circe" % "0.8.8",
"org.tpolecat" %% "doobie-core" % doobieVersion,
"org.tpolecat" %% "doobie-h2" % doobieVersion,
"org.tpolecat" %% "doobie-hikari" % doobieVersion,
"org.tpolecat" %% "doobie-specs2" % doobieVersion,
"org.http4s" %% "http4s-blaze-server" % http4sVersion,
"org.http4s" %% "http4s-circe" % http4sVersion,
"org.http4s" %% "http4s-dsl" % http4sVersion,
"io.circe" %% "circe-core" % circeVersion,
"io.circe" %% "circe-generic" % circeVersion,
"io.circe" %% "circe-config" % "0.6.1",
"mysql" % "mysql-connector-java" % "5.1.34",
"org.slf4j" % "slf4j-api" % "1.7.5",
"ch.qos.logback" % "logback-classic" % "1.0.9"
)
}
resolvers ++= Seq(
"Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
)
/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/bin/java -Djline.terminal=jline.UnsupportedTerminal -Dsbt.log.noformat=true -Dfile.encoding=UTF-8 -Didea.managed=true -Dfile.encoding=UTF-8 -jar /Users/ryanmcavoy/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/202.6397.94/IntelliJ IDEA CE.app.plugins/Scala/launcher/sbt-launch.jar
[info] welcome to sbt 1.3.13 (AdoptOpenJDK Java 1.8.0_262)
[info] loading global plugins from /Users/ryanmcavoy/.sbt/1.0/plugins
[info] loading project definition from /Users/ryanmcavoy/Code/job-board/project
[info] loading settings for project job-board from build.sbt ...
[info] set current project to job-board (in build file:/Users/ryanmcavoy/Code/job-board/)
[warn] sbt server could not start because there's another instance of sbt running on this build.
[warn] Running multiple instances is unsupported
sbt:job-board>
[info] Defining Global / sbtStructureOptions, Global / sbtStructureOutputFile and 1 others.
[info] The new values will be used by cleanKeepGlobs
[info] Run `last` for details.
[info] Reapplying settings...
[info] set current project to job-board (in build file:/Users/ryanmcavoy/Code/job-board/)
[info] Applying State transformations org.jetbrains.sbt.CreateTasks from /Users/ryanmcavoy/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/202.6397.94/IntelliJ IDEA CE.app.plugins/Scala/repo/org.jetbrains/sbt-structure-extractor/scala_2.12/sbt_1.0/2018.2.1+4-88400d3f/jars/sbt-structure-extractor.jar
[info] Reapplying settings...
[info] set current project to job-board (in build file:/Users/ryanmcavoy/Code/job-board/)
[warn] insecure HTTP request is deprecated 'http://repo.typesafe.com/typesafe/releases/'; switch to HTTPS or opt-in as ("Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/").withAllowInsecureProtocol(true)
[warn]
[warn] Note: Unresolved dependencies path:
[error] stack trace is suppressed; run 'last update' for the full output
[error] stack trace is suppressed; run 'last ssExtractDependencies' for the full output
[error] (update) sbt.librarymanagement.ResolveException: Error downloading org.tpolecat:doobie-postgres_2.11:0.8.8
[error] Not found
[error] Not found
[error] not found: /Users/ryanmcavoy/.ivy2/local/org.tpolecat/doobie-postgres_2.11/0.8.8/ivys/ivy.xml
[error] not found: https://repo1.maven.org/maven2/org/tpolecat/doobie-postgres_2.11/0.8.8/doobie-postgres_2.11-0.8.8.pom
[error] download error: Caught java.net.ConnectException: Connection refused (Connection refused) (Connection refused (Connection refused)) while downloading http://repo.typesafe.com/typesafe/releases/org/tpolecat/doobie-postgres_2.11/0.8.8/doobie-postgres_2.11-0.8.8.pom
[error] Error downloading org.tpolecat:doobie-postgres-circe_2.11:0.8.8
[error] Not found
[error] Not found
[error] not found: /Users/ryanmcavoy/.ivy2/local/org.tpolecat/doobie-postgres-circe_2.11/0.8.8/ivys/ivy.xml
[error] not found: https://repo1.maven.org/maven2/org/tpolecat/doobie-postgres-circe_2.11/0.8.8/doobie-postgres-circe_2.11-0.8.8.pom
[error] download error: Caught java.net.ConnectException: Connection refused (Connection refused) (Connection refused (Connection refused)) while downloading http://repo.typesafe.com/typesafe/releases/org/tpolecat/doobie-postgres-circe_2.11/0.8.8/doobie-postgres-circe_2.11-0.8.8.pom
[error] (ssExtractDependencies) sbt.librarymanagement.ResolveException: Error downloading org.tpolecat:doobie-postgres_2.11:0.8.8
[error] Not found
[error] Not found
[error] not found: /Users/ryanmcavoy/.ivy2/local/org.tpolecat/doobie-postgres_2.11/0.8.8/ivys/ivy.xml
[error] not found: https://repo1.maven.org/maven2/org/tpolecat/doobie-postgres_2.11/0.8.8/doobie-postgres_2.11-0.8.8.pom
[error] download error: Caught java.net.ConnectException: Connection refused (Connection refused) (Connection refused (Connection refused)) while downloading http://repo.typesafe.com/typesafe/releases/org/tpolecat/doobie-postgres_2.11/0.8.8/doobie-postgres_2.11-0.8.8.pom
[error] Error downloading org.tpolecat:doobie-postgres-circe_2.11:0.8.8
[error] Not found
[error] Not found
[error] not found: /Users/ryanmcavoy/.ivy2/local/org.tpolecat/doobie-postgres-circe_2.11/0.8.8/ivys/ivy.xml
[error] not found: https://repo1.maven.org/maven2/org/tpolecat/doobie-postgres-circe_2.11/0.8.8/doobie-postgres-circe_2.11-0.8.8.pom
[error] download error: Caught java.net.ConnectException: Connection refused (Connection refused) (Connection refused (Connection refused)) while downloading http://repo.typesafe.com/typesafe/releases/org/tpolecat/doobie-postgres-circe_2.11/0.8.8/doobie-postgres-circe_2.11-0.8.8.pom
[error] Total time: 1 s, completed Aug 10, 2020 1:48:01 PM
I'm using Java 1.8 SDK and scala-sdk-2.13.3
You are not using Scala 2.13.3 because it's written
scalaVersion := "2.11.7"
There is no doobie-postgres 0.8.8 for Scala 2.11
https://mvnrepository.com/artifact/org.tpolecat/doobie-postgres

Scala IntelliJ library import errors

I am new to scala and I am trying to import the following libraries in my build.sbt. When IntelliJ does an auto-update I get the following error:
Error while importing sbt project:
List([info] welcome to sbt 1.3.13 (Oracle Corporation Java 1.8.0_251)
[info] loading global plugins from C:\Users\diego\.sbt\1.0\plugins
[info] loading project definition from C:\Users\diego\development\Meetup\Stream-Processing\project
[info] loading settings for project stream-processing from build.sbt ...
[info] set current project to Stream-Processing (in build file:/C:/Users/diego/development/Meetup/Stream-Processing/)
[info] sbt server started at local:sbt-server-80d70f9339b81b4d026a
sbt:Stream-Processing>
[info] Defining Global / sbtStructureOptions, Global / sbtStructureOutputFile and 1 others.
[info] The new values will be used by cleanKeepGlobs
[info] Run `last` for details.
[info] Reapplying settings...
[info] set current project to Stream-Processing (in build file:/C:/Users/diego/development/Meetup/Stream-Processing/)
[info] Applying State transformations org.jetbrains.sbt.CreateTasks from C:/Users/diego/.IntelliJIdea2019.3/config/plugins/Scala/repo/org.jetbrains/sbt-structure-extractor/scala_2.12/sbt_1.0/2018.2.1+4-88400d3f/jars/sbt-structure-extractor.jar
[info] Reapplying settings...
[info] set current project to Stream-Processing (in build file:/C:/Users/diego/development/Meetup/Stream-Processing/)
[warn]
[warn] Note: Unresolved dependencies path:
[error] stack trace is suppressed; run 'last update' for the full output
[error] stack trace is suppressed; run 'last ssExtractDependencies' for the full output
[error] (update) sbt.librarymanagement.ResolveException: Error downloading org.apache.kafka:kafka-clients_2.11:2.3.1
[error] Not found
[error] Not found
[error] not found: C:\Users\diego\.ivy2\local\org.apache.kafka\kafka-clients_2.11\2.3.1\ivys\ivy.xml
[error] not found: https://repo1.maven.org/maven2/org/apache/kafka/kafka-clients_2.11/2.3.1/kafka-clients_2.11-2.3.1.pom
[error] (ssExtractDependencies) sbt.librarymanagement.ResolveException: Error downloading org.apache.kafka:kafka-clients_2.11:2.3.1
[error] Not found
[error] Not found
[error] not found: C:\Users\diego\.ivy2\local\org.apache.kafka\kafka-clients_2.11\2.3.1\ivys\ivy.xml
[error] not found: https://repo1.maven.org/maven2/org/apache/kafka/kafka-clients_2.11/2.3.1/kafka-clients_2.11-2.3.1.pom
[error] Total time: 2 s, completed Jun 28, 2020 12:11:24 PM
[info] shutting down sbt server)
This is my build.sbt file:
name := "Stream-Processing"
version := "1.0"
scalaVersion := "2.11.8"
libraryDependencies += "org.apache.spark" %% "spark-sql" % "2.4.4"
// https://mvnrepository.com/artifact/org.apache.spark/spark-sql-kafka-0-10_2.12
libraryDependencies += "org.apache.spark" %% "spark-sql-kafka-0-10" % "2.4.4"
// https://mvnrepository.com/artifact/org.apache.kafka/kafka-clients
libraryDependencies += "org.apache.kafka" %% "kafka-clients" % "2.3.1"
// https://mvnrepository.com/artifact/mysql/mysql-connector-java
libraryDependencies += "mysql" % "mysql-connector-java" % "8.0.18"
// https://mvnrepository.com/artifact/org.mongodb.spark/mongo-spark-connector
libraryDependencies += "org.mongodb.spark" %% "mongo-spark-connector" % "2.4.1"
I made a Scala project just to make sure Spark works and my python project using Kafka works as well so I am sure it's not a spark/kafka problem. Any reason why I am getting that error?
Try removing one % before "kafka-clients":
libraryDependencies += "org.apache.kafka" % "kafka-clients" % "2.3.1"
The semantics of %% in SBT is that it appends the Scala version being used to the artifact name, so it becomes org.apache.kafka:kafka-clients_2.11:2.3.1 as the error message shows as well. Note the _2.11 suffix.
This is a nice shorthand for Scala libraries, but can get confusing for beginners, when used with Java libs.

Compile error scala project

I'm taking the coursera scala course. I downloaded the sample project, but I can not compile it. Giving me error when I run the console command.
build.sbt:
name := course.value + "-" + assignment.value
scalaVersion := "2.12.4"
scalacOptions ++= Seq("-deprecation")
// grading libraries
libraryDependencies += "junit" % "junit" % "4.10" % Test
// for funsets
libraryDependencies += "org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.4"
resolvers += "Artima Maven Repository" at "http://repo.artima.com/releases"
// include the common dir
commonSourcePackages += "common"
courseId := "bRPXgjY9EeW6RApRXdjJPw"
Error:
> console
[info] Updating root
[info] Resolved root dependencies
[trace] Stack trace suppressed: run last *:coursierResolution for the full output.
[error] (*:coursierResolution) coursier.ResolutionException: Encountered 1 error(s) in dependency resolution:
[error] org.scalatest:scalatest_2.12:2.2.4:
[error] not found:
[error] /Users/joaonobre/.ivy2/local/org.scalatest/scalatest_2.12/2.2.4/ivys/ivy.xml
[error] /Users/joaonobre/.sbt/preloaded/org.scalatest/scalatest_2.12/2.2.4/ivys/ivy.xml
[error] /Users/joaonobre/.sbt/preloaded/org/scalatest/scalatest_2.12/2.2.4/scalatest_2.12-2.2.4.pom
[error] https://repo1.maven.org/maven2/org/scalatest/scalatest_2.12/2.2.4/scalatest_2.12-2.2.4.pom
[error] http://repo.artima.com/releases/org/scalatest/scalatest_2.12/2.2.4/scalatest_2.12-2.2.4.pom
[error] Total time: 1 s, completed Dec 22, 2017 4:16:17 PM
scala -version
Scala code runner version 2.12.4 -- Copyright 2002-2017, LAMP/EPFL and Lightbend, Inc.
Any idea how to fix it?
Thanks.
As suggested by #laughedelic, Scala 2.12 does not have scalatest-2.2.4. As a result, sbt cannot find the related scalatest pom file. You can pick any of the versions mentioned here.
For instance, try changing scalaTestDependency version to 3.0.5 in the CommonBuild.scala file
lazy val scalaTestDependency = "org.scalatest" %% "scalatest" % "3.0.5"
Here is the course link (Practice Programming Assignment of Week1)

scala error: bad symbolic reference

I was using sbt to compile a scala code, and got the following error message
[error] /user/xyin/Projects/measurement_wspark/src/main/scala/json2csv.scala:41: bad symbolic reference. A signature in DefaultReads.class refers to term time
[error] in package java which is not available.
[error] It may be completely missing from the current classpath, or the version on
[error] the classpath might be incompatible with the version used when compiling DefaultReads.class.
[error] val ts = (json \ "RequestTimestamp").validate[String]
[error] ^
[error] one error found
[error] (compile:compileIncremental) Compilation failed
I was using the play json library to parse json files in my main class. And the content of the build.sbt file is like the following:
name := "json_parser"
version := "1.0"
scalaVersion := "2.10.1"
libraryDependencies += "org.apache.spark" %% "spark-core" % "1.6.1"
resolvers += "Typesafe Repo" at "http://repo.typesafe.com/typesafe/releases/"
libraryDependencies += "com.typesafe.play" %% "play-json" % "2.4.8"
I am totally new to scala and the play framework. Does anyone has any clue about this problem? Thanks!