--add-opens and --add-exports command line options can be conveniently replaced by entries in the META-INF/MANIFEST.MF in the jar file.
However, doing so for a JMH project only works when -f0 is passed.
$ unzip -q -c microbenchmarks.jar META-INF/MANIFEST.MF
Manifest-Version: 1.0
Add-Opens: java.base/java.lang
Main-Class: org.openjdk.jmh.Main
With such a jar, we still see the module error with forking enabled while it runs fine with forking disabled:
module java.base does not "opens java.lang" to unnamed module @5621f724
However, doing so for a JMH project only works when -f0 is passed.
$ unzip -q -c microbenchmarks.jar META-INF/MANIFEST.MF
Manifest-Version: 1.0
Add-Opens: java.base/java.lang
Main-Class: org.openjdk.jmh.Main
With such a jar, we still see the module error with forking enabled while it runs fine with forking disabled:
module java.base does not "opens java.lang" to unnamed module @5621f724