在Windows计算机上,我正在这里浏览入门教程:https://www.scala-sbt.org/1.x/docs/sbt-by-example.html
我能够启动sbt shell并进行编译,但是使用run
命令只是挂起,我被迫按Ctrl-C退出sbt。
直接对JAR文件运行scala
也可以按预期运行。
示例输出如下:
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
[info] Loading project definition from S:\foo-build\project
[info] Loading settings for project foo-build from build.sbt ...
[info] Set current project to foo-build (in build file:/S:/foo-build/)
[info] sbt server started at local:sbt-server-8c6933abcb6848dbd242
sbt:foo-build> about
[info] This is sbt 1.2.8
[info] The current project is ProjectRef(uri("file:/S:/foo-build/"), "foo-build") 0.1.0-SNAPSHOT
[info] The current project is built against Scala 2.12.7
[info] Available Plugins
[info] - sbt.ScriptedPlugin
[info] - sbt.plugins.CorePlugin
[info] - sbt.plugins.Giter8TemplatePlugin
[info] - sbt.plugins.IvyPlugin
[info] - sbt.plugins.JUnitXmlReportPlugin
[info] - sbt.plugins.JvmPlugin
[info] - sbt.plugins.SbtPlugin
[info] sbt, sbt plugins, and build definitions are using Scala 2.12.7
sbt:foo-build> compile
[success] Total time: 0 s, completed Feb 7, 2019 4:40:45 PM
sbt:foo-build> run
Terminate batch job (Y/N)? Y
答案 0 :(得分:0)
这足以满足我的目的。
我可以通过在build.sbt文件中添加一行来解决此问题。添加ThisBuild / scalaVersion:=“ 2.12.8”之后,我能够使用运行命令。按照主要问题中链接的教程进行操作后,我预计不必这样做,但是也许有人可以阐明一下。