Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debug gradle application on Netbeans

I am able to run my application by executing it directly via Netbeans run command, but the application simply runs and no debug information is shown/captured.

Also, I need to pass some arguments to the main method, because I am using Dropwizard.

How can I debug my application on Netbeans?

like image 826
Thiago Avatar asked Oct 02 '14 16:10

Thiago


1 Answers

I created the following task in build.gradle:

task(debug, dependsOn: 'classes', type: JavaExec) {
    main = 'com.example.MyMainClass'
    classpath = sourceSets.main.runtimeClasspath
    args 'server', 'my-application.yml'
    debug true
}

Netbeans runs the application and automatically connects to the debug port and starts debugging.

The 'args' line contains the arguments passed to the main method, needed by Dropwizard.

Based on this article.

like image 180
Thiago Avatar answered Oct 21 '22 21:10

Thiago