Skip to content
Browse files

Removed run and debug tasks as they will be automatically added by Ne…

…tBeans.
  • Loading branch information...
1 parent dd8ef8c commit 0022011720551f09f4448f38f4387d78dd532a52 @kelemen committed Nov 15, 2012
View
13 src/org/netbeans/gradle/project/resources/newproject/multi-project-parent.gradle
@@ -42,19 +42,6 @@ dependencies {
testCompile group: 'junit', name: 'junit', version: '4.10'
}
-if (project.hasProperty('mainClass') && mainClass != '') {
- task (run, dependsOn: classes, type: JavaExec) {
- main = mainClass
- classpath = sourceSets.main.runtimeClasspath
- }
-
- task (debug, dependsOn: classes, type: JavaExec) {
- main = mainClass
- classpath = sourceSets.main.runtimeClasspath
- debug = true
- }
-}
-
task createFolders(description: 'Creates the source folders if they do not exist.') doLast {
sourceSets*.allSource*.srcDirs*.each { File srcDir ->
if (!srcDir.isDirectory()) {
View
20 src/org/netbeans/gradle/project/resources/newproject/single-project.gradle
@@ -3,17 +3,15 @@ apply plugin: 'java'
sourceCompatibility = '${SOURCE_LEVEL}'
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
-String mainClass = '${MAIN_CLASS}'
-
-task (run, dependsOn: classes, type: JavaExec) {
- main = mainClass
- classpath = sourceSets.main.runtimeClasspath
-}
-
-task (debug, dependsOn: classes, type: JavaExec) {
- main = mainClass
- classpath = sourceSets.main.runtimeClasspath
- debug = true
+// 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=<QUALIFIED_CLASS_NAME>" 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 = '${MAIN_CLASS}'
}
repositories {
View
15 src/org/netbeans/gradle/project/resources/newproject/subproject.gradle
@@ -1,9 +1,16 @@
-// Note that "mainClass" must be set before applying "parent.gradle" because
-// "parent.gradle" will define the "run" and "debug" task based on this value.
-ext.mainClass = '${MAIN_CLASS}'
-
apply from: rootProject.file('parent.gradle')
+// 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=<QUALIFIED_CLASS_NAME>" 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 = '${MAIN_CLASS}'
+}
+
dependencies {
// TODO: Add dependencies here
// but note that JUnit should have already been added in parent.gradle.

0 comments on commit 0022011

Please sign in to comment.
Something went wrong with that request. Please try again.