0

As the title states I have added mysql dependency:

    val appName         = "report"
    val appVersion      = "1.0-SNAPSHOT"

    val appDependencies = Seq(
      "com.google.apis" % "google-api-services-analytics" % "v3-rev15-1.8.0-beta",
      "com.google.http-client" % "google-http-client-jackson2" % "1.11.0-beta",
      "com.google.oauth-client" % "google-oauth-client-jetty" % "1.11.0-beta",
      "mysql" % "mysql-connector-java" % "5.1.18",
     )

    val main = PlayProject(appName, appVersion, appDependencies, mainLang = JAVA).settings(
      resolvers += "Google Analytics" at "http://mavenrepo.google-api-java-client.googlecode.com/hg"
    )

This causes:

Caused by: java.lang.NoSuchMethodError: com.google.common.cache.CacheBuilder.maximumSize(I)Lcom/google/common/cache/CacheBuilder;

I guess there is something in the mysql dependencies that gets rid of that method... But what?

4

2 回答 2

0

这通常意味着 JAR 版本的方法签名与调用代码中的内容不匹配。检查 CacheBuilder JAR 的版本。你可能不同步。

于 2012-10-26T14:38:57.030 回答
-1

好的,找到了!

首先,自从 Guava 11 更改后,我需要更新 Guava:

CacheBuilder#maximumSize(int) has been replaced with CacheBuilder#maximumSize(long)

因此,我将 Guava 更新到了最新版本 13.0.1,但仍然出现错误。这是因为反射仍然是错误的。将反射更改为 0.9.8,一切正常。

val appDependencies = Seq(
      "com.google.apis" % "google-api-services-analytics" % "v3-rev15-1.8.0-beta",
      "com.google.http-client" % "google-http-client-jackson2" % "1.11.0-beta",
      "com.google.oauth-client" % "google-oauth-client-jetty" % "1.11.0-beta",
      "mysql" % "mysql-connector-java" % "5.1.18",
      "org.reflections" % "reflections" % "0.9.8",
      "com.google.guava" % "guava" % "13.0.1"
     )
于 2012-10-26T14:46:58.183 回答