melix / jmh-gradle-plugin

Integrates the JMH benchmarking framework with Gradle
Apache License 2.0
662 stars 88 forks source link

jmh.jvmArgs doesn't seem to work correctly #200

Open fcurts opened 3 years ago

fcurts commented 3 years ago

Plugin version 0.6.5, Gradle 7.0.2, macOS 11.4, JDK 11.

I'm trying to set multiple JVM args in build.gradle.kts. I'm not totally sure what the correct syntax is, but I've tried:

jmh {
  jvmArgs.set(listOf(   // also tried jvmArgsAppend, also tried .addAll
    "--module-path=${foo.asPath}",
    "--upgrade-module-path=${bar.asPath}"
  ))
}

The above doesn't work (fails with errors such as "can't find main class --upgrade-module-path"). However, the following works:

jmh {
  jvmArgs.set(listOf(
    "--module-path=${foo.asPath} --upgrade-module-path=${bar.asPath}"
  ))
}

This makes me think that setting multiple JVM args is broken.

blacklion commented 2 years ago

Also, there is problem with spaces in individual jvmArgs. Maybe, on macOS and Linux it is unusual, but on Windows arguments like -Djava.library.path or --moudle-path can contains spaces easily, and I can not find proper escaping for this. "\"arg with spaces\"" doesn't work and simple "arg with spaces" doesn't work either, though with different error messages.