简单地从 github example 复制示例后,我收到以下错误进入我的项目。我能够编译 github 示例项目。我觉得 sbt 一定是在把我搞得一团糟。我正在使用 sbt 0.13
[error] .scala:13: too many arguments for constructor Object: ()Object
[error] class Suppliers(tag: Tag) extends Table[(Int, String, String, String, String, String)](tag, "SUPPLIERS") {
[error] ^
[error].scala:14: object column does not take type parameters.
[error] def id = column[Int]("SUP_ID", O.PrimaryKey) // This is the primary key column
我的 build.sbt 看起来像
导入 AssemblyKeys._
名称 := "我的项目"
版本 := "1.0"
scalaVersion := "2.10.3"
程序集设置
seq(Revolver.settings: _*)
libraryDependencies <+= (scalaVersion)("org.scala-lang"% "scala-compiler"% _)
resolvers += "Sonatype snapshots"at "http://oss.sonatype.org/content/repositories/snapshots/ "
resolvers += "Typesafe Repository"at "http://repo.typesafe.com/typesafe/releases/ "
resolvers += "Sonatype Releases"at "http://oss.sonatype.org/content/repositories/releases "
解析器 += "CDH4"在 "https://repository.cloudera.com/artifactory/cloudera-repos/ "
在“https://repository.jboss.org/nexus/content/repositories/glassfish”处的解析器 +=“glassfish”
resolvers += "spray repo"at "http://repo.spray.io "
解析器 += "http://repo.anormcypher.org/ "处的 "anormcypher"
libraryDependencies +="com.typesafe.akka"%% "akka-actor"% "2.2.0"
libraryDependencies +="com.typesafe.akka"%% "akka-testkit"% "2.2.0"
libraryDependencies +="com.typesafe.akka"%% "akka-transactor"% "2.2.0"
libraryDependencies += "io.spray"% "spray-can"% "1.2-RC2"
libraryDependencies += "io.spray"% "spray-routing"% "1.2-RC2"
libraryDependencies += "io.spray"% "spray-testkit"% "1.2-RC2"
libraryDependencies += "io.spray"%% "spray-json"% "1.2.3"
libraryDependencies += "org.scalatest"% "scalatest_2.10"% "1.9.2"
libraryDependencies += "org.anormcypher"%% "anormcypher"% "0.4.4"
libraryDependencies += "com.h2database"% "h2"% "1.3.166"
libraryDependencies += "com.typesafe.slick"%% "slick"% "2.0.0-M3"
libraryDependencies += "org.postgresql"% "postgresql"% "9.2-1002-jdbc4"
最佳答案
你的进口是错误的。好像你使用了一些工具根据他们的名字自动完成它们(或者你胡乱猜测)。无论如何你导入了错误的东西。只需导入
import scala.slick.driver.H2Driver.simple._
你已经准备好了。参见 http://slick.typesafe.com/doc/2.0.0-M3/gettingstarted.html#imports
关于scala - Slick Lifted 表类型错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20535602/