Adam Rosien
Adam Rosien

Reputation: 545

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

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

Upvotes: 29

Views: 7007

Answers (3)

RubberDuck
RubberDuck

Reputation: 12788

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"

Upvotes: 3

Lee Mighdoll
Lee Mighdoll

Reputation: 1186

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"),

Upvotes: 37

Johnny Everson
Johnny Everson

Reputation: 8601

Take a look at fatal-warnings scalac flag.

Source: https://groups.google.com/forum/?fromgroups=#!topic/simple-build-tool/RcDnib_EGL4

Upvotes: 0

Related Questions