0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【JMH】JMH Gradle PluginでExecution failed for task ':jmhRunBytecodeGenerator'. java.lang.NullPointerException...となって実行が失敗する場合の対処【Gradle】

Last updated at Posted at 2020-10-10

JMH Gradle Pluginme.champeau.gradle.jmh)で、以下のようなスタックトレースが出て実行が失敗する場合への対処法です。

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':jmhRunBytecodeGenerator'.
> A failure occurred while executing me.champeau.gradle.JmhBytecodeGeneratorRunnable
   > Generation of JMH bytecode failed with 1 errors:
       - Annotation generator had thrown the exception.
     java.lang.NullPointerException
        ...

自分は以下のbuild.gradle.ktsでプロジェクトをやっていましたが、group = "com.wrongwrong"としているのに、ベンチマークがcom.wrongwrongパッケージ配下に無かったことが原因でした。

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")
}

上手くいっていなかった時の配置は以下の通りでした。
image.png
以下のように配置することで上手くいきました。
image.png
以下のように、子パッケージに配置した場合も上手くいきます。
image.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?