Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error while adding slick dependency using sbt

I'm new in scala world (coming from android world), I have created scala project with play-framework, everything works fine now I need to add database and for that I decided to chose slick, but when I'm trying to add dependency like that

libraryDependencies ++= Seq(
  "com.typesafe.slick" %% "slick" % "3.1.0",
  "org.slf4j" % "slf4j-nop" % "1.6.4"
)

I'm getting this error log

Error:Error while importing SBT project:<br/>...<br/><pre>[info] Resolving com.typesafe#jse_2.10;1.2.3 ...
[info] Resolving org.scala-sbt#run;0.13.15 ...
[info] Resolving org.scala-sbt.ivy#ivy;2.3.0-sbt-48dd0744422128446aee9ac31aa356ee203cc9f4 ...
[info] Resolving com.typesafe.play#play-exceptions;2.6.5 ...
[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 com.typesafe#config;1.3.1 ...
[info] Resolving org.scala-sbt#main-settings;0.13.15 ...
[info] Resolving com.lightbend.play#play-file-watch_2.10;1.0.0 ...
[info] Resolving com.typesafe.play#sbt-plugin;2.6.5 ...
[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.typesafe.slick#slick_2.12;3.1.0: not found
[error] (*:update) sbt.ResolveException: unresolved dependency: com.typesafe.slick#slick_2.12;3.1.0: not found
[error] Total time: 4 s, completed Sep 28, 2017 12:21:57 PM</pre><br/>See complete log in <a href="file:/home/dev-00/.IntelliJIdea2017.1/system/log/sbt.last.log">file:/home/dev-00/.IntelliJIdea2017.1/system/log/sbt.last.log</a>

here is my hole sbt build script

name := """play-scala-starter-example"""

version := "1.0-SNAPSHOT"

lazy val root = (project in file(".")).enablePlugins(PlayScala)

resolvers += Resolver.sonatypeRepo("snapshots")

scalaVersion := "2.12.2"
libraryDependencies ++= Seq(
  "com.typesafe.slick" %% "slick" % "3.1.0",
  "org.slf4j" % "slf4j-nop" % "1.6.4"
)
libraryDependencies ++= Seq(
  jdbc,
  "com.typesafe.play" %% "anorm" % "2.5.3"
)

libraryDependencies += guice
libraryDependencies += "org.scalatestplus.play" %% "scalatestplus-play" % "3.0.0" % Test
libraryDependencies += "com.h2database" % "h2" % "1.4.194"
libraryDependencies += jdbc
libraryDependencies += "mysql" % "mysql-connector-java" % "5.1.41"
like image 590
jemo mgebrishvili Avatar asked Sep 28 '17 08:09

jemo mgebrishvili


1 Answers

From what I find on maven, it seems only few versions of slick are compiled against scala 2.12:

  • 3.2.1
  • 3.2.0
  • 2.1.0

see: http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.typesafe.slick%22%20AND%20a%3A%22slick_2.12%22

Either use a more recent version of slick or another scala version (2.11.x).

like image 65
Frederic A. Avatar answered Sep 29 '22 12:09

Frederic A.