Debug Gradle plugins with IntelliJ

后端 未结 3 578
南方客
南方客 2020-12-12 15:32

Problem

I want to use the interactive debugger with IntelliJ. Unfortunately, I can\'t convince IntelliJ to load and compile the plugin. Ho

3条回答
  •  离开以前
    2020-12-12 15:52

    I was able to debug gradle sources (including plugins) using -Dorg.gradle.debug=true (found on gradle forum):

    1. Stop daemons if any:

      ./gradlew --stop

    2. Run

      ./gradlew --no-daemon -Dorg.gradle.debug=true

    3. Connect remotely to gradle process (port 5005) - if using IntelliJ IDEA, see OP's image above

    It should stop on breakpoints now.


    BTW, I have created a separate IntelliJ IDEA project for gradle sources. Since I use gradle wrapper, I have grabbed the sources from

    ~/.gradle/wrapper/dists/gradle-1.11-all/7qd8qq8te5j4f5q9aaei3gh3lj/gradle-1.11/src

    In IDEA I did File->Import Project, then selected the above path, then - "Create project from existing sources". Hit Next couple of times (made sure I didn't include any jars from lib/plugins directory, since IDEA would complain that most project files already exist).

    I then created a remote debug configuration in that IDEA project and used it for debugging gradle.

提交回复
热议问题