Sunday Jul 15, 2012

Notes on Gradle and NetBeans

This checks all subfolders of a folder for a file named "build.gradle". If such a file exists, the project type is created:

@org.openide.util.lookup.ServiceProvider(service = ProjectFactory.class)
public class GradleProjectFactory implements ProjectFactory {

    public final String GRADLE_BUILD_FILE = "build.gradle";

    //Specifies when a project is a project, i.e.,
    //if in the project directory "build.gradle" is present:
    public boolean isProject(FileObject projectDirectory) {
        for (FileObject fo : projectDirectory.getChildren()) {
            if (fo.getNameExt().equals(GRADLE_BUILD_FILE)) {
                return true;
        return false;


Actually, simpler is like this:

    public boolean isProject(FileObject projectDirectory) {
        return projectDirectory.getFileObject(GRADLE_BUILD_FILE) != null;

For the rest of the project type, go here:

For the start of a NetBeans Gradle plugin, which anyone out there is welcome to continue working on, go here:

After you install the plugin, go to the Options window and register your Gradle installation.


Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.


« July 2012 »