I'm having a bit of trouble trying to figure out how to set/append to scalacOptions
used by SBT when compiling Build.scala
. Someone on my team copied a bit of code from Akka's Build.scala
and the result was a bunch of deprecated warnings and a feature warning.
$ reload
[info] Loading global plugins from /Users/xxx/.sbt/0.13/plugins
[info] Loading project definition from /Users/xxx/yyy/zzz/project
[info] Compiling 1 Scala source to /Users/xxx/yyy/zzz/project/target/scala-2.10/sbt-0.13/classes...
[warn] there were 3 deprecation warning(s); re-run with -deprecation for details
[warn] there were 1 feature warning(s); re-run with -feature for details
[warn] two warnings found
Things I have tried
scalacOptions ++= Seq("-unchecked", "-feature")
to build.sbt
. I was hoping this would get loaded before Build.scala
was compiled.scalacOptions ++= Seq(...., "-unchecked", "-feature")
in Build.scala
Attempt to set scalacOptions
prior to reload
but it appears to be discarded
$ ;set scalacOptions ++= Seq("-feature", "-deprecated") ;reload
[info] Defining zzz/*:scalacOptions
[info] The new value will be used by zzz/compile:scalacOptions
[info] Reapplying settings...
[info] Set current project to zzz (in build file:/Users/xxx/yyy/zzz/)
[info] Loading global plugins from /Users/xxx/.sbt/0.13/plugins
[info] Loading project definition from /Users/xxx/yyy/zzz/project
[info] Compiling 1 Scala source to /Users/xxx/yyy/zzz/project/target/scala-2.10/sbt-0.13/classes...
[warn] there were 3 deprecation warning(s); re-run with -deprecation for details
[warn] there were 1 feature warning(s); re-run with -feature for details
[warn] two warnings found
[warn] Discarding 1 session setting. Use 'session save' to persist session settings.
Through much blood sweat I was able to find the cause of the deprecated warnings, but I can't find the cause of the feature warning.
Sbt is recursive, which means the Build.scala
in project
directory is build by another definition in its parent directory or build.sbt
in the project
directory.
Therefore you have to create build.sbt
in project
directory. In the project/build.sbt
you should be able to set scalacOptions ++= Seq("-unchecked", "-feature")
.
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