Sbt: Confusing error message when trying to use evaluated on an input key

Created on 3 Mar 2014  路  2Comments  路  Source: sbt/sbt

Given a build.sbt of

version := "0.0.1"

org.scalastyle.sbt.ScalastylePlugin.Settings

val t = taskKey[Unit]("task")

t := {
  //  org.scalastyle.sbt.PluginKeys.scalastyle is an input key
  val ignored = org.scalastyle.sbt.PluginKeys.scalastyle.evaluated
  // should be
  // val ignored = org.scalastyle.sbt.PluginKeys.scalastyle.toTask("").value
}

and project/plugins.sbt of

resolvers += "sonatype-releases" at "https://oss.sonatype.org/content/repositories/releases/"

addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "0.4.0")

sbt.version = 0.13.1

When reloading sbt, the following message is given:

C:\temp\ff\build.sbt:9: error: `value` can only be called on an input task
within a task definition macro, such as := or Def.inputTask.
  val ignored = org.scalastyle.sbt.PluginKeys.scalastyle.evaluated
                                                         ^
[error] Type error in expression
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore?

This is confusing, because it refers to value, not evaluated. What would be nice would be to say something along the lines of 'should you be using toTask()'

Enhancement uncategorized

Most helpful comment

Still an issue in sbt 1.x.x.

All 2 comments

Guys how to deal with this ?

lazy val startServer = taskKey[Unit]("Start PingPong Server before running JS tests")

(startServer in Test) := {
    println("Starting server!!!")
    val main = (runMain in Compile).fullInput("com.example.PingPongClient")
}

 error: `value` can only be called on an input task within a task definition macro, such as := or Def.inputTask.

Still an issue in sbt 1.x.x.

Was this page helpful?
0 / 5 - 0 ratings