Resources Root Directory converted into Test Resources Root After Adding JMH Plugin (IntelliJ Scala)
Answered
I'm trying to add JMH Plugin in Scala Project (Intellij Idea). I'm doing this by adding plugin in plugins.sbt:addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")
Then enabling that plugin in build.sbt:
ThisBuild / version := "0.1.0-SNAPSHOT"
ThisBuild / scalaVersion := "2.13.4"
lazy val root = (project in file("."))
.settings(
name := "my-project"
)
ThisBuild / scapegoatVersion := "1.4.8"
enablePlugins(JmhPlugin)But when I build the project, it converts my src/main/resources (Resources Root) folder to (Test Resources Root). After this I'm unable to access the contents in the config files which were in my src/main/resources. If I delete plugin of JMH then again everything works fine.
Guide me why is it so and how can I avoid this?
Please sign in to leave a comment.
Hello!
When applying the
JmhPlugin,src/main/resourcesis often marked as a test resource directory due to how the benchmarks are typically set.This is because, in most scenarios, JMH benchmarks are treated like tests. They don't execute along with your production code, but are run separately, like test cases. Hence, placing them inside the test resources directory is simply a structural convention shared by many Java Projects.
This way, any resources needed by your benchmarks during their execution (like some datasets stored as files) will need to be in the test resources directory.