0

知道如何为 scala 2.10.1 构建SORM我正在​​尝试生成一个可以在我的 eclipse 项目中使用的 jar 文件。

这是我的代码

import sorm._
case class Coffee(name: String, supplier: Supplier, price: Double, sales: Int, total: Int)
case class Supplier(name: String, street: String, city: String, state: String, zip: String)

object Db extends Instance(
 entities = Set(Entity[Coffee](),Entity[Supplier])),url="jdbc:mysql://localhost:3306/db123")



object sormtest {

 import Db._
 def main(args: Array[String]): Unit = {
 val supplier1 = Supplier("Acme, Inc.", "99 Market Street", "Groundsville", "CA", "95199")
val supplier2 = Supplier("Superior Coffee", "1 Party Place", "Mendocino", "CA", "95460")
val supplier3 = Supplier("The High Ground", "100 Coffee Lane", "Meadows", "CA", "93966")


 Db.save(supplier2)  }}`

我收到以下错误:

Exception in thread "main" java.lang.NoClassDefFoundError: com/mchange/v2/c3p0/impl/AbstractPoolBackedDataSource
    at sorm.core.Connector.<init>(Connector.scala:16)
    at sorm.Instance$Initialization.<init>(Instance.scala:209)
    at sorm.Instance.<init>(Instance.scala:29)
    at Db$.<init>(sormtest.scala:8)
    at Db$.<clinit>(sormtest.scala)
    at sormtest$.main(sormtest.scala:27)
    at sormtest.main(sormtest.scala)
Caused by: java.lang.ClassNotFoundException: com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 7 more

我已经从这里下载了 jar 文件http://mvnrepository.com/artifact/org.sorm-framework/sorm/0.3.8

编辑:Maven 存储库列出了许多要包含的 jar 文件。一旦我添加了它们就解决了我的问题。

4

1 回答 1

3

无需自己构建,SORM 0.3.8在 Maven Central 上可用,并且支持 Scala 2.10.x。

SBT:

libraryDependencies += "org.sorm-framework" % "sorm" % "0.3.8"

马文:

<dependency>
    <groupId>org.sorm-framework</groupId>
    <artifactId>sorm</artifactId>
    <version>0.3.8</version>
</dependency>

如果你真的想要 JAR,你也可以从那里下载它

于 2013-08-26T20:50:00.473 回答