[JAVA] [JMH] What to do if the JMH Gradle Plugin says FAILURE: Build failed with an exception. A failure occurred while executing me.champeau.gradle.IsolatedRunner [Gradle]

This is a workaround for the situation where the following error occurs with JMH Gradle Plugin ( me.champeau.gradle.jmh).

> Task :jmh FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':jmh'.
> A failure occurred while executing me.champeau.gradle.IsolatedRunner
   > Error during execution of benchmarks

In my case, it was due to the benchmark-related directory structure.

As listed in the README of the plugin, JMH Gradle Plugin has a benchmark under src / jmh. It is assumed. For this reason, it worked well by setting where the benchmark is, or by placing the benchmark under src / jmh with the following configuration. image.png

At this point, it should be noted that the benchmark body must be placed in a package that matches the groupId of build.gradle.

bonus

This is the build.gradle.kts I was using.

kotlin:build.gradle.kts


plugins {
    kotlin("jvm") version "1.4.10"
    id("me.champeau.gradle.jmh") version "0.5.2"
}

group = "com.wrongwrong"
version = "1.0-SNAPSHOT"

repositories {
    mavenCentral()
}

dependencies {
    implementation(kotlin("stdlib"))

    implementation(group = "org.openjdk.jmh", name = "jmh-core", version = "1.25.2")
}

Recommended Posts

[JMH] What to do if the JMH Gradle Plugin says FAILURE: Build failed with an exception. A failure occurred while executing me.champeau.gradle.IsolatedRunner [Gradle]
What to do if zip dies if there is a pom when making an executable jar with gradle
[Rails] What to do if you can't get an error message with the errors method
What to do when Gradle says "For more information, please recompile with the -Xlint: unchecked option"
What to do if validation doesn't work with the update action
What to do if you can't install the plugin from the Eclipse marketplace
I can't build if I set the build destination to a simulator with XCode12!
[Rails] What to do if you get an error saying "Could not find a JavaScript runtime." When executing the rails s command on Catalina
What to do if the build fails with the error "Module compiled with Swift x.x.x cannot be imported by the Swift x.x.x compiler"
What to do if you get an "A server is already running." Error when you try to start the rails server
An error occurred when executing a function from MyBatis with the OUT parameter set to CURSOR in PostgreSQL.
What to do if you get an error saying "Please enter a valid value" when getting with Rails datetime_field
What to do if the server tomcat dies
What to do if you can't get the text of an element in Selenium
What to do if you get the error Couldn't find Item without an ID
What to do if the JSONHint annotation does not work with lombok and JSONIC
What to do if you cannot execute with the command "Java package name / class name"
How to make a jar with old Hadoop (hadoop-core-0.20.2-cdh3u6) in Gradle: (What to do if you get Could not expand ZIP ..)
What to do if the debug gem installation fails
What to do if the Rails server can't start
What to do if you accidentally create a model
What to do if an ActionController :: UnknownFormat error occurs
What to do if you installed Ruby with rbenv but the version does not change
[Rails] What to do when the view collapses when a message is displayed with the errors method