How-to: debugging non daemon gradle under Eclipse



This is a short how-to for importing the gradle source code into Eclipse so that one could debug gradle without the running as a daemon. Thus, on-the-fly change&debug would work fine.


1 Prepare the gradle’s Eclipse task
1.2 Edit gradle/eclipse.gradle
1.3 Replace 1.7 by 1.8
1.4 Replace JavaSE-1.7 by JavaSE-1.8
1.5 Add the following line after the line 15
1.6 Save & exit

2 Build the Eclipse’s files for importing gradle
2.1 gradlew eclipse

3 Customize Eclipse for JavaSE-1.8
3.1 Assign the JRE: Windows->Preference->Java->Installed JRE
3.2 Assign the JDK for the execution environement: Windows->Preference->Java->Execution Environment->JavaSE-1.8

4 Import gradle as Import->Existing Project into Eclipse
4.1 All projects should have a clean compile for the src/main/java directory. It remains some compile errors on few projects on the src/test/groovy directory but this is not a problem for running the java code.

5 Define a launch configuration for gradle
5.1 Open the launcher project
5.2 Click right on src/main/java/org.gradle.launcher.Main and choose Run as Java Application
5.3 Open the launcher menu: Tab Run->Run Configuration and select Main
5.4 Rename Main into Gradle
5.5 In the Argument tab: add --no-daemon -Dfile.encoding=UTF-8 -Dorg.gradle.appname=gradle build
5.6 In the Argument tag, change the Working Directory element Other to the directory where you have your gradle project to debug
5.7 Save and Run


Additionally, one can fix the internalAndroidPerformanceTesting compile errors by adding all jars found under the directory build-android-libs to the classpath of the project