我尝试按照sbt-documentation中的说明创建一个hello world。
$ sbt new sbt/scala-seed.g8
WARN: No sbt.version set in project/build.properties, base directory: /Users/pankaj/Work/Code/learn
[warn] Executing in batch mode.
[warn] For better performance, hit [ENTER] to switch to interactive mode, or
[warn] consider launching sbt without any commands, or explicitly passing 'shell'
[info] Set current project to learn (in build file:/Users/pankaj/Work/Code/learn/)
Minimum Scala build.
name [My Something Project]: hello
Template applied in ./hello
$
现在我进入刚刚创建的“hello”目录并运行“sbt”。
$ sbt
[info] Loading project definition from /Users/pankaj/Work/Code/learn/hello/project
[info] Updating {file:/Users/pankaj/Work/Code/learn/hello/project/}hello-build...
[info] Resolving org.scala-sbt.ivy#ivy;2.3.0-sbt-2cf13e211b2cb31f0d3b317289dca70[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Compiling 1 Scala source to /Users/pankaj/Work/Code/learn/hello/project/target/scala-2.10/sbt-0.13/classes...
java.util.UnknownFormatConversionException: Conversion = '0'
at java.util.Formatter.checkText(Formatter.java:2579)
at java.util.Formatter.parse(Formatter.java:2565)
at java.util.Formatter.format(Formatter.java:2501)
…
…
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)
[error] (compile:compile) java.util.UnknownFormatConversionException: Conversion = '0'
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? q
$
首先,当生成的build.sbt文件在“inThisBuild”设置下指定了“scalaVersion”2.12.1时,我无法理解构建工具使用scala-2.10的原因。
其次,主要问题是,如何调试和修复
UnknownFormatConversionException: Conversion = '0'
不确定如何超越“Hello,World!”示例