问题
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?
回答1:
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).
回答2:
I have found this in the Repository:
"org.postgresql" % "postgresql" % "9.2-1003-jdbc4"
回答3:
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
回答4:
I solved the problem using the information at the following link:
https://github.com/tminglei/slick-pg/issues/1
I hope you find it useful!! :)
good luck ;)
linixinil.
回答5:
In file application.conf:
db.default.driver=org.postgresql.Driver
db.default.url="jdbc:postgresql://localhost:5432/dataBaseName"
db.default.user=user
db.default.password="password"
create the pasta /lib in your main project and should add the .jar do postgres.
Download here, and after reload the project.
来源:https://stackoverflow.com/questions/14840392/unresolved-dependency-for-postgresql-9-2-jar-in-play-framework