Play框架中对PostgreSQL 9.2 jar的未解决依赖性 [英] unresolved dependency for postgresql 9.2 jar in play framework
问题描述
我正在将PostgreSQL 9.2和Play框架2.1一起使用
I am using postgresql 9.2 with play framework 2.1
我在这里下载了驱动程序: http://jdbc.postgresql.org/download.html (JDBC4 Postgresql驱动程序,版本9.2-1002)
I downloaded the driver here: http://jdbc.postgresql.org/download.html (JDBC4 Postgresql Driver, Version 9.2-1002)
我的project/Build.scala
文件如下:
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)
}
我已将jdbc驱动程序放在播放目录结构中的以下位置:
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
但是,使用play run
运行应用程序时,出现以下错误,构建失败:
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
有关如何获得Play的任何提示!识别我的jar文件?
推荐答案
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"
或者您可以通过将myApp/lib
文件夹中并从project/Build.scala
文件中删除任何依赖项来使用9.2版本(lib
文件夹由sbt自动添加).
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).
这篇关于Play框架中对PostgreSQL 9.2 jar的未解决依赖性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!