Closed Gontran08 closed 7 years ago
I'm not sure if NB can have multiple debug sessions concurrently. So, if you really want to debug multiple projects, you will have to attach and unattach manually. You cannot debug your root project because it is not a java project. You can lie to NB that it is a Java project but I don't think that would really solve your issue.
As for custom debugging, you will have to configure your task to be used for debugging and select the debug mode to "Debugger attaches to debugee". That is,
Also, if you want to keep the original debug mode, you can do that and use the ${jpda.port}
in the arguments and process it in your build script. Say, you can add an argument for the debug task like -PjpdaDebugPort=${jpda.port}
and then in your build script try reading project.jpdaDebugPort
and set it for your farmRunWarDebug
task :
farmRunWarDebug.debugPort = project.hasProperty('jpdaDebugPort') : project.jpdaDebugPort : null
There is the problem, Debug is not there on the root project, only on the subprojects.
Having a debug command on the root project would not solve your issue. Because even if it was supported somehow, the best thing NB could do is to attach to the first project and then let others run. In this case, you might as well just start everything and keep attaching to the one you want, or run debug for the one, you want to debug first and run the others after that. Maybe there could be a more simple way to attach to a single project but I'm uncertain how.
Can you describe precisely, what exactly do you want to happen (in more specific terms, than "I want to debug everything" or have "Debug" command on the root project)?
I want to debug my servlet container. I'm deploying both of my subprojects using the same servlet container, so there is only one java process running. The problem is that I can't launch one of my subprojects first, then launch the other, because the Gretty plugin do not allow it. I must launch my task on the root project in order for Gretty to launch all of my subprojects. When I launch Gretty in debug mode, the task prepare the project, then wait for the debugger on port 5005. Once it's connected, Gretty deploy my subprojects on the servlet container.
So, I would like to be able to launch my Gradle task on the root project using Run or Debug, and if it's Debug, being able to connect automatically the Netbeans debugger on the port 5005.
So, you mean that the task to run is the task of the root project? If that is the case, then the easiest thing to do is to reconfigure the "Debug" command (in Project properties/Built-in tasks) to run the ":farmRunWarDebug" (notice the starting colon). This will cause the "farmRunWarDebug" to be run on the root project regardless what subproject you are using the "Debug" action on (if you have different kinds of debugging, you might also want to consider adding different profiles).
Another way is to fake the root project to be a Java project but I would not recommend that since you will have to configure the "Debug" command anyway. Regardless, this is what you must add to your root project's build script to fake it to be a Java project:
if (project.hasProperty('evaluatingIDE') && project.property('evaluatingIDE') == 'NetBeans') {
apply plugin: 'java'
}
I added "apply plugin: 'java'" on my root project and now everything works perfectly. I was able to configure my task on the root project. I also added a starting colon on the Debug and Run command to make sure my subprojects are never launched alone.
Thanks a lot for your time.
I'm currently creating a multi-project build with Gradle. I have to debug all my subprojects at the same time, but it's not possible right now. There is no option to Run or Debug on the root project, it's only possible to Build or Test. Debug is only available when we select a subproject. My subprojects are two web apps, and I use gretty to manage my servlet container. I created a multi-project in order to share my servlet container. I need to launch the task farmRunWarDebug of the gretty plugin and attach the netbeans debugger. The only way I found to do that, it's to manually launching my task using the context menu and attach the debugger manually.