6
votes

I am getting deprecation and feature warnings when compiling my SBT project definition (i.e. the files inside the project directory). SBT version is 0.13.0.

I do not get more info on these by setting scalacOptions := Seq("-feature", "-deprecation"), this only seems to work for project source files and not project definition files.

Anyone know how I can set deprecation and warning for the compiler when it compiles the project definition?

[info] Loading project definition from /home/xxx/website/project
[warn] there were 2 deprecation warning(s); re-run with -deprecation for details
[warn] there were 4 feature warning(s); re-run with -feature for details
[warn] two warnings found
1

1 Answers

8
votes

Create project/build.sbt project definition file with the following content:

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

Since any *.sbt file under project belongs to the meta (build) project, it sets up the Scala compiler for the build configuration not the environment for the project under build.

It was tested with a sample sbt multi-project:

[info] Compiling 1 Scala source to /Users/jacek/sandbox/so/multi-0.13.1/project/target/scala-2.10/sbt-0.13/classes...
[warn] /Users/jacek/sandbox/so/multi-0.13.1/project/Build.scala:4: method error in object Predef is deprecated: Use `sys.error(message)` instead
[warn]   lazy val e = error("Launcher did not provide the Ivy home directory.")
[warn]                ^
[warn] one warning found

...when it compiled the following project/Build.scala:

import sbt._

object Build extends Build {
  lazy val e = error("Launcher did not provide the Ivy home directory.")
}