使用mysql连接器播放框架未解决的依赖关系

时间:2015-06-18 02:01:24

标签: jdbc playframework playframework-2.0

我首先使用的是play framework(Java)2.38版。我正在尝试将MySQL连接到我的应用程序,它给了我一个未解决的依赖错误。我已经查看过这个主题的所有主题,但没有任何效果,这就是我所拥有的......

Application.conf

db.default.driver=com.mysql.jdbc.Driver
db.default.url="jdbc:mysql://127.0.0.1:3306/mydatabase"
db.default.user=root
db.default.password=""

plugins.sbt

resolvers += "Typesafe repository" at "https://repo.typesafe.com/typesafe/releases/"

// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.8")

// web plugins

addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-mocha" % "1.0.0")
addSbtPlugin("mysql" % "mysql-connector-java" % "5.6.24")

build.sbt

name := """TestApp"""

version := "1.0-SNAPSHOT"

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

scalaVersion := "2.11.1"

libraryDependencies ++= Seq(
  javaJdbc,
  javaEbean,
  cache,
  javaWs,
   "mysql" % "mysql-connector-java" % "5.6.24"
)

libraryDependencies += "org.json" % "json" % "20141113"


fork in run := true

我得到的错误如下

 Error:Error while importing SBT project:
...
    at sbt.std.Transform$$anon$4.work(System.scala:64)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
    at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
    at sbt.Execute.work(Execute.scala:244)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
    at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
    at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
[error] (*:update) sbt.ResolveException: unresolved dependency: 
mysql#mysql-connector-java;5.6.24: not found
Invalid response.
Invalid response.
Invalid response.
Java HotSpot(TM) Client VM warning: ignoring option MaxPermSize=384M; support was removed in 8.0

See complete log in C:\Users\testingapp\.IntelliJIdea14

\ SYSTEM \日志\ sbt.last.log

我不知道我做错了什么或SBT是否在某处失败,有什么建议吗?

1 个答案:

答案 0 :(得分:0)

MySQL java连接器版本与MySQL服务器版本无关。 有关详细信息,请参阅MySQL Connector/J compatibility chart

撰写时,MySQL> = 4.0的最新mysql-connector-java版本为5.1.35(请参阅Maven Central)。

您应该相应地更改您的依赖声明。

"mysql" % "mysql-connector-java" % "5.1.35"