Javadoc + go to sources for buildSrc/src/main/groovy in IDEA Comunity?

There is a trick with Gradle wrapper --distribution-type ALL to enable javadoc and goto implementation for Gradle API from build scripts in IDEA IDE.

Now I’m working with an internal plugin inside buildSrc/src/main/groovy and IDEA doesn’t provide javadoc nor goto source from plugin code.

I think I can temporary add dependencies to buildSrc/build.gradle to Gradle API sticking implementation to the same Gradle version as in $proj/gradle/wrapper/gradle-wrapper.properties but I have to remember not to commit them.

What are your workflow of plugin development inside buildSrc? How do you enable conviniences?

Though I don’t write plugin in Java but Groovy I tried to apply:

https://docs.gradle.org/current/userguide/java_gradle_plugin.html

plugins {
    id 'java-gradle-plugin'
}

Docs says:

adds the gradleApi() dependency to the api configuration

which sounded promising ))

Application has effect, I could remove buildSrc/src/main/resources/META-INF/gradle-plugins/xjc.properties and plugin generates it for me into buildSrc/build/resources.

But still there is no javadoc and goto source. I just read decompiled Gradle API / implementation.

So I managed to “attach” Gradle sources to IDEA modules.

In a project’s module UI I selected module buildSrc/main => “Dependencies” tab => Edit of C:\srv\gradle\caches\6.7.1\generated-gradle-jars\gradle-api-6.7.1.jar and added sources, that are C:\srv\gradle\wrapper\dists\gradle-6.7.1-all\2moa8rlfac5eqlcfgk98k0deb\gradle-6.7.1\src.

Idea detects multiply sources under above directory automatically.

The only big issue is with IDEA “Refresh Gradle” button. It erases source association. So after each refresh I have to attach sources manually.

Is there some cool way to “inject” sources to IDEA project automatically?

I asked for possible solution of automatic source association via org.jetbrains.gradle.plugin.idea-ext:

I think I can temporary add dependencies to buildSrc/build.gradle to Gradle API sticking implementation to the same Gradle version as in $proj/gradle/wrapper/gradle-wrapper.properties but I have to remember not to commit them .

I was wrong with this. Gradle stopped publishing modules to repository at v6.1.1.

The only way to build Gradle plugins is with hard dependency to Gradle distribution.