Debugging - jpenilla/run-task GitHub Wiki
IntelliJ IDEA
IntelliJ's Gradle integration allows running Gradle tasks with debugging out of the box, and it will automatically attach to the correct JVM.
Hot-swap
Many JVMs implement basic hot-swap support out of the box. However, the JetBrains runtime includes enhanced redefinition features such as adding and removing methods. See below for instructions to use the JetBrains runtime.
If you are using Shadow to relocate dependencies, you may need to disable relocations or create a separate artifact without relocations for hot-swap to work properly.
settings.gradle.kts
plugins {
// add toolchain resolver
id("org.gradle.toolchains.foojay-resolver-convention") version "0.9.0"
}
build.gradle.kts
tasks.withType(xyz.jpenilla.runtask.task.AbstractRun::class) {
javaLauncher = javaToolchains.launcherFor {
vendor = JvmVendorSpec.JETBRAINS
languageVersion = JavaLanguageVersion.of(21)
}
jvmArgs("-XX:+AllowEnhancedClassRedefinition")
}