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:
-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.
In bash you should be able to use Ctrl+L, on OSX you can also use Cmd+K.
Removes all generated files from the target directory. Compiles source code files that are in src/main/scala, src/main/java, and the root directory of the project. Automatically recompiles source code files while you're running SBT in interactive mode (i.e., while you're at the SBT command prompt).
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
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
.
As Jacek mentioned in his response, in build.sbt
you can add showSuccess := false
to suppress the [success]
message. To suppress the [info]
message, I'd set the logLevel to Level.Warn
for the run
configuration only. Putting it together, you want to add these lines to build.sbt
:
showSuccess := false
logLevel in run := Level.Warn
You should be able to get rid of the "Set current project" line by adding this to your build.sbt
file:
onLoadMessage := ""
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With