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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With