Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unresolved dependency for postgresql 9.2 jar in play framework

I am using postgresql 9.2 with play framework 2.1

I downloaded the driver here: http://jdbc.postgresql.org/download.html (JDBC4 Postgresql Driver, Version 9.2-1002)

My project/Build.scala file is as follows:

import sbt._
import Keys._
import play.Project._

object ApplicationBuild extends Build {

  val appName = "myApp"
  val appVersion = "0.1"

  val appDependencies = Seq(
    "postgresql" % "postgresql" % "9.2-1002.jdbc4")

  val main = play.Project(appName, appVersion, appDependencies)
}

I have placed the jdbc driver in the following locations in the play directory structure:

myApp/lib/postgresql-9.2-1002.jdbc4.jar
myApp/lib/9.2-1002.jdbc4.jar
myApp/lib/postgresql/postgresql/9.2-1002.jdbc4.jar

However, running the app with play run, I get the following error and the build fails:

[warn]  module not found: postgresql#postgresql;9.2-1002.jdbc4              
[warn] ==== local: tried
[warn]   /home/ubuntu/play-2.1.0/repository/local/postgresql/postgresql/9.2-1002.jdbc4/ivys/ivy.xml
[warn] ==== Typesafe Releases Repository: tried
[warn]   http://repo.typesafe.com/typesafe/releases/postgresql/postgresql/9.2-1002.jdbc4/postgresql-9.2-1002.jdbc4.pom
[warn] ==== Typesafe Snapshots Repository: tried
[warn]   http://repo.typesafe.com/typesafe/snapshots/postgresql/postgresql/9.2-1002.jdbc4/postgresql-9.2-1002.jdbc4.pom
[warn] ==== public: tried
[warn]   http://repo1.maven.org/maven2/postgresql/postgresql/9.2-1002.jdbc4/postgresql-9.2-1002.jdbc4.pom
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::                       
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: postgresql#postgresql;9.2-1002.jdbc4: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
sbt.ResolveException: unresolved dependency: postgresql#postgresql;9.2-1002.jdbc4: not found

Any tips on how to get the Play! to recognize my jar file?

like image 307
David Kaczynski Avatar asked Feb 12 '13 19:02

David Kaczynski


3 Answers

The 9.2 version of Postgresql driver has not yet hit the Maven central repo, so you'll have to use the 9.1 version :

"postgresql" % "postgresql" % "9.1-901-1.jdbc4"

Or you can use the 9.2 version by dropping the JAR in your myApp/lib folder and remove any dependency from your project/Build.scala file (the lib folder is automatically added by sbt).

like image 141
ndeverge Avatar answered Jan 25 '23 21:01

ndeverge


I have found this in the Repository:

"org.postgresql" % "postgresql" % "9.2-1003-jdbc4"
like image 31
Ayoub Avatar answered Jan 25 '23 21:01

Ayoub


When I change 9.2 version to 9.1 version, it works perfectly. Thanks for your answer nico_ekito

My buid.scala

  val appDependencies = Seq(
  "postgresql" % "postgresql" % "9.1-901-1.jdbc4",
  jdbc,
  javaCore,
  javaEbean
  )

My application.conf

db.default.driver=org.postgresql.Driver
db.default.url="jdbc:postgresql://localhost:5432/DBName"
db.default.user=postgres
db.default.password=123456
like image 43
Phuc Vuu Avatar answered Jan 25 '23 23:01

Phuc Vuu