【问题标题】:Changing scala version of play from console从控制台更改 scala 版本的播放
【发布时间】:2014-03-08 17:38:17
【问题描述】:

我应该将我的项目恢复到 scala 2.10.0,但看起来我不能从控制台中恢复。我尝试在 build.sbt 中使用 scalaVersion := "2.10.0" 进行清理和重建,但它继续使用 2.10.2。 我该如何做类似“play scala-version 2.10.0”的事情? (这似乎不正确) 我知道它使用 2.10.2,因为它使用 scala-compiler 并反映 2.10.2

【问题讨论】:

    标签: scala playframework-2.0 sbt


    【解决方案1】:
    jacek:~/sandbox/play-ground/xApp
    $ play
    [info] Loading global plugins from /Users/jacek/.sbt/0.13/plugins
    [info] Updating {file:/Users/jacek/.sbt/0.13/plugins/}global-plugins...
    [info] Resolving org.fusesource.jansi#jansi;1.4 ...
    [info] Done updating.
    [info] Loading project definition from /Users/jacek/sandbox/play-ground/xApp/project
    [info] Set current project to xApp (in build file:/Users/jacek/sandbox/play-ground/xApp/)
           _
     _ __ | | __ _ _  _
    | '_ \| |/ _' | || |
    |  __/|_|\____|\__ /
    |_|            |__/
    
    play 2.2.2 built with Scala 2.10.3 (running Java 1.7.0_51), http://www.playframework.com
    
    > Type "help play" or "license" for more information.
    > Type "exit" or use Ctrl+D to leave this console.
    
    [xApp] $ show scalaVersion
    [info] 2.10.3
    [xApp] $ set scalaVersion := "2.10.0"
    [info] Defining *:scalaVersion
    [info] The new value will be used by *:allDependencies, *:dependencyUpdatesData and 11 others.
    [info]  Run `last` for details.
    [info] Reapplying settings...
    [info] Set current project to xApp (in build file:/Users/jacek/sandbox/play-ground/xApp/)
    [xApp] $ show scalaVersion
    [info] 2.10.0
    [xApp] $ session save
    [info] Reapplying settings...
    [info] Set current project to xApp (in build file:/Users/jacek/sandbox/play-ground/xApp/)
    [xApp] $ show scalaVersion
    [info] 2.10.0
    [xApp] $ about
    [info] This is sbt 0.13.0
    [info] The current project is {file:/Users/jacek/sandbox/play-ground/xApp/}xapp 1.0-SNAPSHOT
    [info] The current project is built against Scala 2.10.0
    [info] Available Plugins: com.typesafe.sbt.SbtGit, com.typesafe.sbt.SbtProguard, growl.GrowlingTests, org.sbtidea.SbtIdeaPlugin, sbtman.Plugin, np.Plugin, com.timushev.sbt.updates.UpdatesPlugin, play.Project, com.typesafe.sbteclipse.plugin.EclipsePlugin, com.typesafe.sbt.SbtNativePackager
    [info] sbt, sbt plugins, and build definitions are using Scala 2.10.3
    

    之后您应该会在项目中看到build.sbt 中的版本。

    jacek:~/sandbox/play-ground/xApp
    $ cat build.sbt
    name := "xApp"
    
    version := "1.0-SNAPSHOT"
    
    libraryDependencies ++= Seq(
      jdbc,
      anorm,
      cache
    )
    
    scalaVersion := "2.10.0"
    

    【讨论】:

    • 太完美了,非常感谢。我在哪里可以找到一些关于游戏控制台使用的页面?我迷失在那些文档中!
    • 这只是 SBT 本身(Play 位于其上)。阅读scala-sbt.org/release/docs/index.html 的文档 - 每天几页,一些 StackOverflow'ing 和阅读 Play 的配置(build.sbtproject/*.scala + project/*.sbt),你就会知道这一切。感谢您接受我的回答!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-07-02
    • 2012-09-24
    • 1970-01-01
    • 2019-06-28
    • 2021-06-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多