How to add jdbc dependency to Play project?

I am using play 2.2.2

.

I would like to include a library jdbc

in a Play / Scala project as mentioned in SQL Database Access .

Here my rootproject/project/plugins.sbt

:

libraryDependencies ++= Seq(
  jdbc
  "com.google.zxing"   %  "core"                 % "2.0",
  "mysql"              %  "mysql-connector-java" % "5.1.27",
  "com.typesafe.slick" %% "slick"                % "2.1.0",
  "org.slf4j"          %  "slf4j-nop"            % "1.6.4"
)

      

When compiling the project, I get the following jdbc

not found error,

$ /usr/local/play-2.2.2/play compile
/packup/smartad-core/project/plugins.sbt:8: error: not found: value jdbc
      jdbc
          ^
[error] Type error in expression
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? q

      

My rootproject/build.sbt

just

  import play.Project._                                                                                                                               

  name := "smartad-backend"                                                                              

  version := "1.0"                                                                                       

  playScalaSettings  

      

Links

https://www.playframework.com/documentation/2.3.x/ScalaAnorm

+3


source to share


1 answer


You have to combine both of these blocks into your build.sbt

file. plugins.sbt

is for adding sbt plugins like sbt plugin for playback. But about that.



import play.Project._                                                                                                                               

name := "smartad-backend"                                                                              

version := "1.0"                                                                                       

playScalaSettings 

libraryDependencies ++= Seq(
   jdbc,
   ...
)

      

+5


source







All Articles