Slackbot
12/07/2023, 3:51 PMReuben Firmin
12/07/2023, 3:52 PMapplication {
mainClass.set("ah.MainKt")
tasks.named<JavaExec>("run") {
doFirst {
...
if (hotswapAgentCore != null) {
println("Monitoring ${project.buildDir.absolutePath}/classes/kotlin/jvm/main/ for changes!")
jvmArgs(
"-javaagent:${hotswapAgentCore.absolutePath}=autoHotswap=true",
"--add-opens java.base/java.lang=ALL-UNNAMED",
"--add-opens java.base/jdk.internal.loader=ALL-UNNAMED",
"--add-opens java.base/java.io=ALL-UNNAMED",
"--add-opens java.desktop/java.beans=ALL-UNNAMED",
"--add-opens java.desktop/com.sun.beans=ALL-UNNAMED",
"--add-opens java.desktop/com.sun.beans.introspect=ALL-UNNAMED",
"--add-opens java.desktop/com.sun.beans.util=ALL-UNNAMED",
// TODO try using the non-deprecated alternative to buildDir (I couldn't figure out how to get a path from it in 60s so gave up)
"-Dhotswap.classes.dir=${project.buildDir.absolutePath}/classes/kotlin/jvm/main/"
)
} else {
throw IllegalStateException("Hotswap Agent Core dependency not found in the 'implementation' configuration.")
}
}Reuben Firmin
12/07/2023, 3:53 PM> Task :run FAILED
Monitoring /home/rfirmin/code/clients/lobster/build/classes/kotlin/jvm/main/ for changes!
Unrecognized option: --add-opens java.base/java.lang=ALL-UNNAMED
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':run'.
> Process 'command '/usr/lib/jvm/java-17-openjdk-amd64/bin/java'' finished with non-zero exit value 1Reuben Firmin
12/07/2023, 3:53 PM> /usr/lib/jvm/java-17-openjdk-amd64/bin/java --add-opens
Error: --add-opens requires modules to be specifiedVampire
12/07/2023, 3:54 PMVampire
12/07/2023, 3:54 PM"--add-opens java.base/java.lang=ALL-UNNAMED",, but "--add-opens", "java.base/java.lang=ALL-UNNAMED",Reuben Firmin
12/07/2023, 3:54 PMVampire
12/07/2023, 3:55 PMdoFirst { ... }) is a very bad idea and with configuration cache even forbiddenReuben Firmin
12/07/2023, 3:58 PM