I get an error there were 15 feature warning(s); re-run with -feature for details
:
$ /usr/local/sbt/bin/sbt
[info] Loading project definition fr
You should add
scalacOptions += "-feature"
to your build.sbt and execute reload if your sbt console is running (or restart it).
Alternatively if you want to set it only for a single session, while in sbt console, you can write set scalacOptions += "-feature"
, this setting is applied immediately, no need to reload or restart sbt console.
Re-run with -feature for details
I don't get a chance to use sbt on a daily basis, so this is just to confirm the suggestion in the linked answer:
$ sbt
[info] Set current project to Compiler options (in build file:/home/apm/tmp/sbtwarn/)
> compile
[info] Compiling 1 Scala source to /home/apm/tmp/sbtwarn/target/scala-2.11/classes...
[warn] there was one feature warning; re-run with -feature for details
[warn] one warning found
[success] Total time: 4 s, completed Jan 12, 2015 9:45:17 AM
> set scalacOptions in ThisBuild ++= Seq("-feature")
[info] Defining {.}/*:scalacOptions
[info] The new value will be used by compile:scalacOptions
[info] Reapplying settings...
[info] Set current project to Compiler options (in build file:/home/apm/tmp/sbtwarn/)
> compile
[info] Compiling 1 Scala source to /home/apm/tmp/sbtwarn/target/scala-2.11/classes...
[warn] /home/apm/tmp/sbtwarn/src/main/scala/Sample.scala:6: postfix operator head should be enabled
[warn] by making the implicit value scala.language.postfixOps visible.
[warn] This can be achieved by adding the import clause 'import scala.language.postfixOps'
[warn] or by setting the compiler option -language:postfixOps.
[warn] See the Scala docs for value scala.language.postfixOps for a discussion
[warn] why the feature should be explicitly enabled.
[warn] Console println (List(1,2,3) head)
[warn] ^
[warn] one warning found
[success] Total time: 1 s, completed Jan 12, 2015 9:45:46 AM
Hey, it worked!