使用 sbt 构建命令行应用程序 [英] Using sbt to build command line application

查看:41
本文介绍了使用 sbt 构建命令行应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人成功关注http://www.scala-sbt.org/0.13/docs/Command-Line-Applications.html使用最新的 sbt 0.13.7 吗?

Anybody successfully followed http://www.scala-sbt.org/0.13/docs/Command-Line-Applications.html using latest sbt 0.13.7 ?

对于 0.12.0,我得到未解决的依赖项org.scala-sbt#command;0.12.0: not found".尝试使用 0.13.7 版命令会在 InitialGlobalLogging 周围的 Main.scala 文件中出现编译错误:

I get unresolved dependency "org.scala-sbt#command;0.12.0: not found" for 0.12.0. Trying command version 0.13.7 gets compile errors in Main.scala file around initialGlobalLogging:

[error] Unspecified value parameter console.                                       
[error]      GlobalLogging.initial(MainLogging.globalDefault _, File.crea          
teTempFile("hello", "log") )                                                       
[error]      GlobalLogging.initial(MainLogging.globalDefault _, File.crea          
teTempFile("hello", "log") )                                                       

谢谢

推荐答案

0.13.7 似乎更新了 GlobalLogging.initial() 的参数类型和数量.(http://www.scala-sbt.org/0.13.7/api/#sbt.GlobalLogging$)

0.13.7 seems to have updated the type and number of parameters for GlobalLogging.initial(). (http://www.scala-sbt.org/0.13.7/api/#sbt.GlobalLogging$)

尝试更改 Main.scala 中的最后两行:

Try changing the last two lines in Main.scala:

来自

/** Configures logging to log to a temporary backing file as well as to the console. 
* An application would need to do more here to customize the logging level and
* provide access to the backing file (like sbt's last command and logLevel setting).*/
def initialGlobalLogging: GlobalLogging =
      GlobalLogging.initial(MainLogging.globalDefault _, File.createTempFile("hello", "log"))

val consoleOut = ConsoleOut.systemOut
def initialGlobalLogging: GlobalLogging =
   GlobalLogging.initial(MainLogging.globalDefault(consoleOut).apply, java.io.File.createTempFile("hello", "log"), consoleOut )

这篇关于使用 sbt 构建命令行应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆