My sample sbt plugin is compiling fine with scala version 2.10.6. I am trying to upgrade scalaVersion := "2.11.7" in the sbt plugin build.sbt.
It breaks with the followinng CTE :-
/Users/mogli/gitrepos/study/SbtPlugins/ScalaPlugin/src/main/scala/base/BasePlugin.scala:21: can't expand macros compiled by previous versions of Scala [error]
val projects = thisProject.value.dependencies
This was working fine with scalaVersion := "2.10.6" as suggested by Micro Dotta in below question :-
accessing dependent (not child) projects in sbt plugin
Simplified sbt plugin BasePlugin.scala:
package base
import sbt.{ThisBuild, Def, TaskKey, AutoPlugin}
import sbt._
import Keys._
object BasePlugin extends AutoPlugin {
object autoImport {
lazy val customtask: TaskKey[Unit] = TaskKey("customtask")
}
import autoImport.customtask
override def projectSettings: Seq[Def.Setting[_]] = Seq(
customtask := {
val projects = thisProject.value.dependencies
projects map println
}
)
}
How to get it work with scalaVersion := "2.11.7"? I want this plugin to use with projects that are using scal version 11.