I use javafx-gradle-plugin and want to debug the program with IDEA, but failed
Is there any debuggable example working for IDEA + gradle ?
Tried the gradle Debug "jfxRun" using IDEA, but not working..
netstat -an | find "5005" not find the debug server port..
my build.gradle looks like below:
group 'com.baozs.atwork.tools'
version '1.0-SNAPSHOT'
buildscript {
ext.kotlin_version = '1.1.3'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath group: 'de.dynamicfiles.projects.gradle.plugins', name: 'javafx-gradle-plugin', version: '8.8.2'
}
}
apply plugin: 'java'
apply plugin: 'kotlin'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
testCompile group: 'junit', name: 'junit', version: '4.12'
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
jar {
manifest {
attributes(
'Class-Path': configurations.compile.collect { it.getName() }.join(' '),
'Main-Class': 'com.baozs.atwork.tools.QIMSyncTools.app.MainKt'
)
}
}
apply plugin: 'javafx-gradle-plugin'
jfx {
// minimal requirement for jfxJar-task
// com.baozs.atwork.tools.QIMSyncTools.app.MainKt
verbose = true
mainClass = 'com.baozs.atwork.tools.QIMSyncTools.app.MainKt'
manifestAttributes = new HashMap<String, String>()
manifestAttributes['Main-Class'] = 'com.baozs.atwork.tools.QIMSyncTools.app.MainKt'
// minimal requirement for jfxNative-task
vendor = 'SyncToolsGui'
jvmArgs = ["-Xdebug", "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"]
launcherArguments = ["-Xdebug", "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"]
}
task fatJfxJar(type: Jar) {
baseName = project.name + '-fat'
manifest {
attributes["Main-Class"] = "com.baozs.atwork.tools.QIMSyncTools.app.MainKt"
}
from { configurations.runtime.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
also tried the demo, not working either:

Hi, you might want to use runJavaParameter for this
jfx {
runJavaParameter = '-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005'
}
This parameter was introduced to have debug-settings running, but not having this in production outcome.
I'll try it tonight ! It works!
Can't repeat this in my.
build.gradle
group 'ru.mc'
version '1.0'
buildscript {
dependencies {
classpath group: 'de.dynamicfiles.projects.gradle.plugins', name: 'javafx-gradle-plugin', version: '8.8.2'
}
repositories {
mavenLocal()
mavenCentral()
}
}
apply plugin: 'java'
sourceCompatibility = 1.8
repositories {
mavenLocal()
mavenCentral()
}
apply plugin: 'javafx-gradle-plugin'
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
}
jfx {
verbose = true
mainClass = 'ru.mc.ltec.MainClass'
vendor = 'dev'
runJavaParameter = '-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005'
}
Set breakpoint (for example to MainClass.launch(args) method) and click Debug for jfxRun task.
Running log
12:09:54: Executing external task 'jfxRun'...
:compileJava UP-TO-DATE
:processResources NO-SOURCE
:classes UP-TO-DATE
:jar UP-TO-DATE
:jfxJar
:jfxRun
Running JavaFX Application
Running command: java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 -jar project-jfx.jar
Application starts immediately without stopping.
I need some additional actions about which in the topic was not explicitly mentioned above?
Hi @zvpdev, did you solve this issue?
Hi @FibreFoX when I run debug mode with
runJavaParameter = '-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005'
it's not work (port 5005 isn't open).
But when I run command:
java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 -jar project-jfx.jar manually - it opens the port 5005.