我正在使用从github.com下载的示例Lift框架。 Scala 2.9.1是其中的版本。我在cmd中使用Container:start命令启动服务器,我可以在localhost:8080中看到该应用程序。但我在Eclipse中安装了scala 2.10.0。如果我将项目与Eclipse IDE集成,则localhost:8080会显示一些错误。问题是什么?
我有build.sbt
:
name := "Lift 2.5 starter template"
version := "0.0.1"
organization := "net.liftweb"
scalaVersion := "2.9.1"
resolvers ++= Seq("snapshots" at "http://oss.sonatype.org/content/repositories/snapshots",
"releases" at "http://oss.sonatype.org/content/repositories/releases"
)
seq(com.github.siasia.WebPlugin.webSettings :_*)
unmanagedResourceDirectories in Test <+= (baseDirectory) { _ / "src/main/webapp" }
scalacOptions ++= Seq("-deprecation", "-unchecked")
libraryDependencies ++= {
val liftVersion = "2.5-RC2"
Seq(
"net.liftweb" %% "lift-webkit" % liftVersion % "compile",
"net.liftweb" %% "lift-mapper" % liftVersion % "compile",
"net.liftmodules" %% "lift-jquery-module" % (liftVersion + "-2.2"),
"org.eclipse.jetty" % "jetty-webapp" % "8.1.7.v20120910" % "container,test",
"org.eclipse.jetty.orbit" % "javax.servlet" % "3.0.0.v201112011016" % "container,test" artifacts Artifact("javax.servlet", "jar", "jar"),
"ch.qos.logback" % "logback-classic" % "1.0.6",
"org.specs2" %% "specs2" % "1.12.1" % "test",
"com.h2database" % "h2" % "1.3.167"
)
}
我已经在projects / plugins.sbt
中集成了Eclipse addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0")
答案 0 :(得分:2)
要更新Eclipse,您需要更新ScalaIDE插件才能使用2.10。 http://download.scala-ide.org/sdk/e37/scala210/dev/site/
如果您的build.sbt
或plugin.sbt
包含一句话:
scalaVersion := "2.10.0"
SBT将找到该行,解释它,并自动为类型安全仓库下载2.10 Scala编译器和2.10 Scala库。这可以在类型安全解析器中找到,它通常作为全局解析器添加到~/.sbt/
中,就像这个resolvers += Classpaths.typesafeResolver
一样。
如果您要在构建定义中使用scalaVersion := "2.10.0"
行编译项目(同样适用于插件)并且您没有安装Scala 2.10或在您的路径中,那么SBT将自动从typesafe解析器并将下载的文件放入
~/.sbt/boot/scala-2.10.0/lib/
,您可以在其中找到以下文件:
jansi.jar, jline.jar, scala-compiler.jar, scala-library.jar, scala-reflect.jar
以下是最初使用Scala 2.9.2创建的lift 2.5M3应用程序的示例build.sbt
配置,升级到2.10。
name := "secret"
version := "0.1-SNAPSHOT"
scalaVersion := "2.10.0"
seq(com.github.siasia.WebPlugin.webSettings :_*)
seq(jrebelSettings: _*)
jrebel.webLinks <++= webappResources in Compile
resolvers ++= Seq(
"Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots",
"Sonatype releases" at "https://oss.sonatype.org/content/repositories/releases",
"Scala 2.10 support for rogue" at "https://github.com/mattpap/rogue/"
)
libraryDependencies ++= {
val liftVersion = "2.5-M4"
Seq(
"com.foursquare" %% "rogue-field" % "2.0.0-beta22",
"com.foursquare" %% "rogue-core" % "2.0.0-beta22",
"com.foursquare" %% "rogue-lift" % "2.0.0-beta22",
"net.liftweb" %% "lift-webkit" % liftVersion % "compile",
"net.liftweb" %% "lift-mongodb-record" % "2.5-M4",
"com.mongodb.casbah" % "casbah_2.9.0" % "2.2.0-SNAPSHOT",
"org.specs2" %% "specs2" % "1.12.3" % "test"
)
}
classpathTypes ~= (_ + "orbit")
libraryDependencies ++= Seq(
"org.eclipse.jetty.orbit" % "javax.servlet" % "3.0.0.v201112011016" % "container" artifacts (Artifact("javax.servlet", "jar", "jar")
)
)
libraryDependencies ++= Seq(
"org.eclipse.jetty" % "jetty-webapp" % "8.1.7.v20120910" % "container" artifacts (Artifact("jetty-webapp", "jar", "jar")
)
)
port in container.Configuration := 5555
EclipseKeys.withSource := true
这是plugins.sbt文件,应该在PROJECTROOT / project / plugins.sbt中
libraryDependencies <+= sbtVersion(v => v match {
case "0.11.0" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.0-0.2.8"
case "0.11.1" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.1-0.2.10"
case "0.11.2" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.2-0.2.11"
case "0.11.3" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.3-0.2.11.1"
case x if (x.startsWith("0.12")) =>
"com.github.siasia" %% "xsbt-web-plugin" % "0.12.0-0.2.11.1"
})
resolvers += "Jawsy.fi M2 releases" at "http://oss.jawsy.fi/maven2/releases"
addSbtPlugin("fi.jawsy.sbtplugins" %% "sbt-jrebel-plugin" % "0.9.0")
这是全局插件文件,应该在〜/ .sbt / plugins / plugins.sbt 如果你把东西放在这里,它将被加载到你系统范围内的所有SBT项目中。这当然只代表你的机器。
resolvers += Classpaths.typesafeResolver
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0")
resolvers += "jgit-repo" at "http://download.eclipse.org/jgit/maven"
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.5.0")
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.2.0")
resolvers += "Jawsy.fi M2 releases" at "http://oss.jawsy.fi/maven2/releases"
addSbtPlugin("fi.jawsy.sbtplugins" %% "sbt-jrebel-plugin" % "0.9.0")