How to suppress Warning by sbt compile

时间秒杀一切 提交于 2019-12-22 10:34:22

问题


I am currently working on project, my project works fine and working. But i want to suppress the warning when i run sbt compile. when i run sbt compile i don't want my terminal to show warning.

[warn] /Users/kumarshubham/Documents/repositories/alice/app/misc/QueryDB.scala:14: imported `QueryString' is permanently hidden by   definition of class QueryString in package misc
[warn] import misc.QueryString
[warn]             ^
[warn] /Users/kumarshubham/Documents/repositories/alice/app/misc/QueryDB.scala:26: method apply in trait WithResult is deprecated: Use   [[fold]], [[foldWhile]] or [[withResult]] instead, which manages resources and memory
[warn]       val resultSet = query().map(
[warn]                       ^
[warn] /Users/kumarshubham/Documents/repositories/alice/app/misc/QueryDB.scala:58: method apply in trait WithResult is deprecated: Use [[fold]], [[foldWhile]] or [[withResult]] instead, which manages resources and memory
[warn]       val resultSet = query().map(
[warn]                       ^
[warn] /Users/kumarshubham/Documents/repositories/alice/app/misc/QueryDB.scala:89: method apply in trait WithResult is deprecated: Use [[fold]], [[foldWhile]] or [[withResult]] instead, which manages resources and memory
[warn]       val resultSet = query().map(
[warn]                       ^
[warn] /Users/kumarshubham/Documents/repositories/alice/app/misc/QueryDB.scala:121: method apply in trait WithResult is deprecated: Use [[fold]], [[foldWhile]] or [[withResult]] instead, which manages resources and memory
[warn]         val resultSet = query().map(
[warn]                         ^
[warn] /Users/kumarshubham/Documents/repositories/alice/app/misc/QueryDB.scala:329: method apply in trait WithResult is deprecated: Use [[fold]], [[foldWhile]] or [[withResult]] instead, which manages resources and memory
[warn]       val resultSet = query().map(
[warn]                       ^
[warn] /Users/kumarshubham/Documents/repositories/alice/app/misc/QueryDB.scala:351: method apply in trait WithResult is deprecated: Use [[fold]], [[foldWhile]] or [[withResult]] instead, which manages resources and memory
[warn]       val resultSet = query().map(
[warn]                       ^
[warn] 7 warnings found

回答1:


SBT documentation have a perfect manual on how to update logging level for whole project or just for one task.

You need to do something like this:

set logLevel in compile := Level.Error

If you want to set this level in your sbt file, you could do that, by adding this line into your build.sbt file

logLevel := Level.Error 

Also if you want to specify logLevel only for compile task it will be a little bit tricky, since you're probably need to set level for dependent tasks as well.

For more information take a look here - http://www.scala-sbt.org/release/docs/Howto-Logging.html



来源:https://stackoverflow.com/questions/31934645/how-to-suppress-warning-by-sbt-compile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!