JettyRun task jvm args to enable remote debugging

(Tim-Hinnerk Heuer) #1

How do I enable a JettyRun task and pass it custom jvm args to enable remote debugging in my IDE?

I know the jvm args but could only pass them to other task types.

(Jon Austen) #2

From GRADLE bug #1804, some ideas:

:black_medium_small_square:Just edit the .gradle file to change the content of the args parameter. Bad because it adds noise to the version control. :black_medium_small_square:Read a file with the arguments, parse it, and feed args with them. You need to know Groovy to do so, and it is tricky to handle the OS conventions: Windows accepts only double quotes, Unix-based systems are more flexible, etc. :black_medium_small_square:Use -Pfoo=bar. Limited. :black_medium_small_square:Use tasks.addRule and extract the arg from the task name. Too hackish and limited.’

(Jon Austen) #3

I have not tried it, but it seems like you could do something like this:

tasks.withType(Test) {
    jvmArgs '-Xms128m', '-Xmx1024m', '-XX:MaxPermSize=128m', '-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044'
    maxParallelForks = 8
    testLogging {
        exceptionFormat "full"
        events "started", "passed", "skipped", "failed", "standardOut", "standardError"
        displayGranularity = 0

Or perhaps something more like this?

tasks.withType(Jetty) {
    jvmArgs '-Xms128m', '-Xmx1024m', '-XX:MaxPermSize=128m', '-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044'