Gradle
0 2,018 3 minutes read
We will contact you soon.
Greeting.java
package com.javacodegeeks.gradle.netbeans;
/**
*
* @author Andres Cespedes
* @since 1.7
*/
public class Greeting {
public static void main(String[] args) {
System.out.println("Hello World JCG in Gradle NetBeans");
}
}
The last step is to set this class as Main Class, so in build.gradle script of subproject HelloProject type full name without extension. The build.gradle script may looks like this:
// Note: "common.gradle" in the root project contains additional initialization
// for this project. This initialization is applied in the "build.gradle"
// of the root project.
// NetBeans will automatically add "run" and "debug" tasks relying on the
// "mainClass" property. You may however define the property prior executing
// tasks by passing a "-PmainClass=" argument.
//
// Note however, that you may define your own "run" and "debug" task if you
// prefer. In this case NetBeans will not add these tasks but you may rely on
// your own implementation.
if (!hasProperty('mainClass')) {
ext.mainClass = 'com.javacodegeeks.gradle.netbeans.Greeting'
}
dependencies {
// TODO: Add dependencies here
// but note that JUnit should have already been added in parent.gradle.
// By default, only the Maven Central Repository is specified in
// parent.gradle.
//
// You can read more about how to add dependency here:
// http://www.gradle.org/docs/current/userguide/dependency_management.html#sec:how_to_declare_your_dependencies
}
So, make right click on subproject HelloProject then Run, the output will be this:
Tips
This was an example of Gradle NetBeansPlugin.

We will contact you soon.