<0.6.0> rror: object scalastyle is not a member of package org.scalastyle.sbt.PluginKeys.scalastyle.toTask("").value
kcheng888 opened this issue · comments
I am follow the manual at http://www.scalastyle.org/sbt.html try to make the style check part of test flow.
after I add below to projects/plugins.sbt
addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "0.6.0")
resolvers += "sonatype-releases" at "https://oss.sonatype.org/content/repositories/releases/"
// Create a default Scala style task to run with tests
lazy val testScalaStyle = taskKeyUnit
testScalaStyle := {
org.scalastyle.sbt.PluginKeys.scalastyle.toTask("").value
}
(test in Test) <<= (test in Test) dependsOn testScalaStyle
I got the error.
error: object scalastyle is not a member of package org
org.scalastyle.sbt.PluginKeys.scalastyle.toTask("").value
^
Ran into a similar issue with PluginKeys
not being a member of package sbt
. After spending a lot of time banging my head against my desk with this here's what I got working for me. In my build.sbt:
lazy val testScalaStyle = taskKey[Unit]("testScalaStyle")
testScalaStyle := (org.scalastyle.sbt.ScalastylePlugin.scalastyle in Compile).toTask("").value
(Keys.compile in Compile) <<= (Keys.compile in Compile) dependsOn testScalaStyle
You'll probably have to change your code to something like
lazy val testScalaStyle = taskKey[Unit]("testScalaStyle")
testScalaStyle := (org.scalastyle.sbt.ScalastylePlugin.scalastyle in Test).toTask("").value
(test in Test) <<= (test in Test) dependsOn testScalaStyle
I'm using scala 2.11 with sbt 0.13.6 and scalastyle-sbt-plugin 0.6.0
I'm using Keys.compile
here instead of just compile
because another plugin I use, sbt-protobuf, also exports a compile
key, so just saying compile
results in an ambiguous reference.
It would be great if the maintainers could update the documentation found here under "Running scalastyle as part of another task" because it didn't seem to work at all.
Hi,
I've added a bit of a better description.
http://www.scalastyle.org/sbt.html
Have fun,
Matthew Farwell.
2014-12-30 21:51 GMT+01:00 Travis Kaufman notifications@github.com:
After spending a lot of time banging my head against my desk with this
here's what I got working for me. In my build.sbt:lazy val testScalaStyle = taskKeyUnit
testScalaStyle := (org.scalastyle.sbt.ScalastylePlugin.scalastyle in Compile).toTask("").value
(Keys.compile in Compile) <<= (Keys.compile in Compile) dependsOn testScalaStyle
I'm using scala 2.11 with sbt 0.13.6 and scalastyle-sbt-plugin 0.6.0
I'm using Keys.compile here instead of just compile because another
plugin I use, sbt-protobuf, also exports a compile key, so just saying
compile results in an ambiguous reference.It would be great if the maintainers could update the documentation found
here http://www.scalastyle.org/sbt.html under "Running scalastyle as
part of another task" because it didn't seem to work at all.—
Reply to this email directly or view it on GitHub
#32 (comment)
.