Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way in sbt to convert compiler warnings to errors so the build fails?

Tags:

scala

sbt

I want to "ban" some or all compiler warnings.

like image 764
Adam Rosien Avatar asked Mar 25 '13 20:03

Adam Rosien


2 Answers

You can pass options from sbt to the scala compiler, including the one that turns warnings into errors.

I usually add these:

scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature", "-Xfatal-warnings"),
like image 126
Lee Mighdoll Avatar answered Nov 06 '22 21:11

Lee Mighdoll


Per the scalac options documentation, you can pass either -Werror or -Xfatal-warnings.
You can do that in sbt by appending to scalacOptions.

scalacOptions += "-Werror"
like image 44
RubberDuck Avatar answered Nov 06 '22 21:11

RubberDuck