sbt complains about JmhPlugin not found

78 Views Asked by At

I'm trying to use sbt JmhPlugin and I'm following the instructions found here: https://github.com/sbt/sbt-jmh

So I added the plugin to project/plugins.sbt and then I added to build.sbt the enablePlugins(JmhPlugin) line so my build files look like this:

project/plugins.sbt:

addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.4")

project/build.properties:

sbt.version = 1.8.2

build.sbt:

ThisBuild / version := "0.1.0-SNAPSHOT"

ThisBuild / scalaVersion := "2.13.10"

lazy val root = (project in file("."))
  .settings(
    name := "myproj"
  )
libraryDependencies += "org.scalactic" %% "scalactic" % "3.2.15"

libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.15" % "test"
libraryDependencies += "org.typelevel" %% "cats-effect" % "2.5.3"

val catsVersion = "2.9.0"
libraryDependencies += "org.typelevel" %% "cats-core" % catsVersion
libraryDependencies += "org.typelevel" %% "cats-free" % catsVersion
libraryDependencies += "org.typelevel" %% "cats-laws" % catsVersion
libraryDependencies += "org.typelevel" %% "cats-mtl-core" % "0.7.1"

libraryDependencies += "org.typelevel" %% "simulacrum" % "1.0.1"

libraryDependencies += "org.scalamacros" %% "resetallattrs" % "1.0.0"
libraryDependencies += "org.scalameta" %% "munit" % "0.7.22"
libraryDependencies += "org.typelevel" %% "discipline-munit" % "1.0.6"

scalacOptions ++= Seq(
  "-deprecation",
  "-encoding", "UTF-8",
  "-feature",
  "-language:_",
  "-Ymacro-annotations"
)


enablePlugins(JmhPlugin)

but when I'm running sbt build it complains that it cannot find the JmhPlugin:

error: not found: value JmhPlugin
enablePlugins(JmhPlugin)
^

What am I doing wrong here? Also, how should I debug this issue?

Thanks!

1

There are 1 best solutions below

3
On

Using this build.sbt file on an empty project it seems to at least resolve the dependencies:

name := "myproj"
version := "0.1.0-SNAPSHOT"
scalaVersion := "2.13.10"

libraryDependencies ++= Seq(
  "org.scalactic" %% "scalactic" % "3.2.15",
  "org.scalatest" %% "scalatest" % "3.2.15" % "test",
  "org.typelevel" %% "cats-effect" % "2.5.3",
  "org.typelevel" %% "cats-core" % "2.9.0",
  "org.typelevel" %% "cats-free" % "2.9.0",
  "org.typelevel" %% "cats-laws" % "2.9.0",
  "org.typelevel" %% "cats-mtl-core" % "0.7.1",
  "org.typelevel" %% "simulacrum" % "1.0.1",
  "org.scalamacros" %% "resetallattrs" % "1.0.0",
  "org.scalameta" %% "munit" % "0.7.22",
  "org.typelevel" %% "discipline-munit" % "1.0.6"
)

scalacOptions ++= Seq(
  "-deprecation",
  "-encoding", "UTF-8",
  "-feature",
  "-language:_",
  "-Ymacro-annotations"
)

enablePlugins(JmhPlugin)