Debugging buildSrc gradle plugin during project sync/refresh

Answered

I have a small buildSrc gradle plugin and I'm seeing some very weird behavior but only during project sync/refresh. Is it possible to run it in with debugging enabled?

1
5 comments

What exactly do you want to debug? You can debug Gradle buildSrc task code of your custom Gradle tasks.

0
Avatar
Permanently deleted user

The issue is that I want to debug whatever intellij is doing with it during refresh/reimport/sync gradle project.

I can run any task I want in debug mode, but I can't find any way to run gradle project sync in debug mode.

0

You can not debug IDE importing process from simple project. This is in-IDE process and you will need IDE's sources to debug it. IDE invokes Gradle Tooling API for operating with Gradle from.

0

I have a large project with 3 submodules.  Each submodule is a large project in and of itself.  This is not a simple project.

Project  

    Submodule1

          Submodule2

In Submdule2 there is a large Gradle configuration that loads a ton of Gradle tasks to run a bunch of different commands.   If I open submodule2 as a stand-alone project, it works great.  All of the tasks are there.

If I open Project, IDEA gets stuck on Gradle “configuring” and it never completes.   If I run a Gradle command from the command line with --debug, I can see from the output roughly how far Gradle has gotten with configuring.

I specifically want to be able to add break points to any build.gradle file (or files that are “apply from:” called by the build.gradle file and have the IDE allow me to debug the loading of these complex projects.  If the IDE and Gradle together are going to get stuck on Configuring when Gradle loads, I need a means to debug it.   If I was trying to debug an individual gradle task, I could run the task and my breakpoints would be respected.

Trying to recreate this for bug reporting would be a nightmare scenario.  Judging by a search on “gradle stuck on configuring” there are an endless number of reasons this could be happening and debugging is really the only efficient way to chase this down and step through it.

0

In this scenario, would be best done from our end as Gradle Import/Sync process is different from a regular Gradle Task.

I would recommend creating a YouTrack Issue with the detailed description of the problem and a link to the reproducer Project.

If the issue only affects one specific Project and it cannot be shared, initial investigation can be done based on the IDEA's diagnostic data.

0

Please sign in to leave a comment.