Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
986 views
in Technique[技术] by (71.8m points)

scala - How to suppress info and success messages in sbt?

When I do sbt run I see some header and footer info which I would like to get rid of:

$ sbt run 
[info] Set current project to XXX (in build file:/path/to/dir/)
<actual program output goes here; stuff I care about>
[success] Total time: 68 s, completed Apr 1, 2012 7:30:45 PM
$ 

How can I get rid of those 2 additional lines (i.e., the [info] and [success] lines)? Are there some build.sbt configuration settings available to do that? Ideally I don't want to have another tool/dependency just to get rid of those 2 lines.

Following is a list of things I have tried:

  • Set run logLevel to Warn
  • Set Global logLevel to Warn
  • Set -Dsbt.log.noformat=true

Workaround that I am currently using: Copy the java invocation that sbt generates (by doing ps or top) as a result of doing fork in run := true and manually run that java command directly on command line.

It would best and much cleaner if sbt can be told not to print those lines.

  • Scala version: 2.9.1
  • SBT version: 0.11.1
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

sbt 1.x, sbt 0.13.13+

Use -warn or -error. See Fixes with compatibility implications for sbt 0.13.13 release:

it is strongly encouraged to migrate to the single hyphen options: -error, -warn, -info, and -debug

sbt 0.13.1

To disable info messages run SBT with --warn or --error command line options.

To disable [success] messages set showSuccess to false.

Bringing it all together, it gives you the following options:

  • On command line use the following:

      $ sbt --error 'set showSuccess := false' run
    
  • In build.sbt add showSuccess := false

      $ cat build.sbt
      showSuccess := false
    

and execute sbt --error run.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...