Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to "re-run with -deprecation for details" in sbt?

Tags:

sbt

People also ask

What is deprecation warning in Scala?

An annotation that designates that a definition is deprecated. A deprecation warning is issued upon usage of the annotated definition. Library authors should state the library's deprecation policy in their documentation to give developers guidance on how long a deprecated definition will be preserved.

How do I run a jar file in sbt?

When you uses Simple Build Tool Command 'sbt package', it creates a jar file that includes the class files from your source code and also the content from your src/main/resources folder. Your project dependencies (JAR files in your project's lib folder or managed dependencies declared in build. sbt).


sbt shell

While in sbt shell (if you don't want to change your build.sbt):

$ sbt
> set ThisBuild/scalacOptions ++= Seq("-unchecked", "-deprecation")
> compile
> exit

Due to in ThisBuild, set applies the settings to all sub-projects, as well.

Command Line

You could also run the above as a single command on command line.

sbt '; set ThisBuild/scalacOptions ++= Seq("-unchecked", "-deprecation") ; compile' 

The trick is to use ; (semicolons) to separate commands and ' (ticks) to include all ;-separated commands as a single argument to sbt.

sbt < 1.x

Instead of ThisBuild/scalacOptions use scalacOptions in ThisBuild


scalacOptions := Seq("-unchecked", "-deprecation")

Add this setting to your build.sbt, and, if you have a multi-module project, add it to every project's settings.