compile時に
there were 1 deprecation warnings; re-run with -deprecation for detailsと出てきていたものの、どうやって設定するのやら悩んでいましたが、
下記の設定でOKでした。
set scalacOptions += "-deprecation"
compile時に
there were 1 deprecation warnings; re-run with -deprecation for detailsと出てきていたものの、どうやって設定するのやら悩んでいましたが、
set scalacOptions += "-deprecation"
I personally switched to the Eclipse plugin after 20 years of emacs. Certainly before then, I tried the plugin; but for the complex projects I do, it didn't live up to what I needed. Now, I would now never go back to emacs.『eclipseのScalaプラグインの出来が素晴らしくて、20年使ってきたけどemacsにはもう戻れません!』
http://stackoverflow.com/questions/6566470/how-to-add-sbteclipse-plugin-to-sbt-0-10-x→バージョンの指定方法を参考にしました。
resolvers += {
val typesafeRepoUrl = new java.net.URL("http://repo.typesafe.com/typesafe/releases")
val pattern = Patterns(false, "[organisation]/[module]/[sbtversion]/[revision]/[type]s/[module](-[classifier])-[revision].[ext]")
Resolver.url("Typesafe Repository", typesafeRepoUrl)(pattern)
}
libraryDependencies <<= (libraryDependencies, sbtVersion) { (deps, version) =>
deps :+ ("com.typesafe.sbteclipse" %% "sbteclipse" % "1.2" extra("sbtversion" -> version))
}
resolvers += Classpaths.typesafeResolver
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse" % "1.4.0")
eclipse create-srcを実行すると、.projectファイルと.classpathファイルが作成される。eclipseにて、.projectファイルが存在するパスを指定し、プロジェクト毎import。という感じです。import sbt._
class LiftProject(info: ProjectInfo) extends DefaultWebProject(info) {
val liftVersion = "2.3"
// uncomment the following if you want to use the snapshot repo
val scalatoolsSnapshot = ScalaToolsSnapshots
// If you're using JRebel for Lift development, uncomment
// this line
// override def scanDirectories = Nil
override def libraryDependencies = Set(
"net.liftweb" %% "lift-webkit" % liftVersion % "compile",
"net.liftweb" %% "lift-mapper" % liftVersion % "compile",
"org.mortbay.jetty" % "jetty" % "6.1.22" % "test",
"junit" % "junit" % "4.5" % "test",
"ch.qos.logback" % "logback-classic" % "0.9.26",
"org.scala-tools.testing" %% "specs" % "1.6.6" % "test",
"com.h2database" % "h2" % "1.2.138",
"com.foursquare" %% "rogue" % "1.0.14-SNAPSHOT" withSources()
) ++ super.libraryDependencies
}
"com.foursquare" %% "rogue" % "1.0.14-SNAPSHOT" withSources()の"1.0.14-SNAPSHOT"については、下記のリポジトリを参考にその時々のバージョンを指定して下さい。
package code.model
import net.liftweb._
import mongodb._
import util.Props
import com.mongodb.{Mongo, ServerAddress}
object MongoConfig {
def init: Unit = {
val srvr = new ServerAddress("127.0.0.1", 27017)
MongoDB.defineDb(DefaultMongoIdentifier, new Mongo(srvr), "foo")
}
}
class Boot {
def boot {
if (!DB.jndiJdbcConnAvailable_?) {
//MongoDb boot
MongoConfig.init
(後略)
set USER_PATH=%USER_PATH%;"%SCALA_HOME%\bin"
set USER_PATH=%USER_PATH%;%SBT_HOME%
setx PATH %USER_PATH%
mongod --dbpath e:\data\db--dbpathオプションでデータを保持するフォルダを指定しています。
mongoと打つとシェルが立ち上がります。
db.foo.insert({name:"aaa"})これでfooというコレクションにnameがaaaという値が登録されます。
db.foo.find()