kelemen / netbeans-gradle-project

This project is a NetBeans plugin able to open Gradle based Java projects. The implementation is based on Geertjan Wielenga's plugin.
172 stars 57 forks source link

How to run/debug main project in multi project #374

Open richardSch opened 6 years ago

richardSch commented 6 years ago

I converted a Netbeans/Ant project with sub-projects to Gradle. The run/debug menu and right click items are disabled for the main/root project but are enabled for sub-projects. The main project has a gradle 'run' target . Is there a way to enable run/debug on the root project?

kelemen commented 6 years ago

The only way for it is to apply the "java" plugin on the root project as well (because this is done by the Java module of the plugin). So, sadly you can only apply a hack to enable this by adding this to the root build.gradle:

if (project.hasProperty('evaluatingIDE') && project.property('evaluatingIDE') == 'NetBeans') {
    apply plugin: 'java'
}

If you don't want to clutter your build, you can add this code to the <user-home>/.gradle/init.gradle file (with an appropriate condition to apply it only for projects you need it).