gpt4 book ai didi

java - 在电梯应用程序中将 Scala 版本更新为 2.10.0

转载 作者:搜寻专家 更新时间:2023-11-01 03:25:20 28 4
gpt4 key购买 nike

我正在使用从 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")

最佳答案

要更新 Eclipse,您需要更新 ScalaIDE 插件以使用 2.10。 http://download.scala-ide.org/sdk/e37/scala210/dev/site/

如果您的 build.sbtplugin.sbt 包含一行内容:

scalaVersion := "2.10.0"

SBT 将找到该行,对其进行解释,并自动为类型安全存储库下载 2.10 Scala 编译器和 2.10 Scala 库。这是在类型安全解析器中找到的,它通常作为全局解析器添加到 ~/.sbt/ 中,就像这样 resolvers += Classpaths.typesafeResolver

如果您将在构建定义中使用 scalaVersion := "2.10.0" 行编译项目(同样适用于插件)并且您没有安装 Scala 2.10 或在您的路径,然后 SBT 将自动从类型安全解析器下载它并将下载的文件放在~/.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")

关于java - 在电梯应用程序中将 Scala 版本更新为 2.10.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15407739/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com