Hello again! I've been writing Gradle plugins for ...
# community-support
j
Hello again! I've been writing Gradle plugins for a few months now, but I've been relying on manually looking up JavaDocs online for anything in Gradle as IntelliJ is not downloading (or using?) the sources for the Gradle API. Is there any way I can fix that? Or do I just have to cope with using the online JavaDocs for now?
e
are you using the Groovy DSL (
.gradle
buildscript files) or the Kotlin DSL (
.gradle.kts
buildscript files)?
in my experience, Kotlin DSL has worked perfectly in IntelliJ for the past couple years at least. the Groovy DSL has never had its docs or sources integrated that well into the IDE
j
No, I just mean writing Gradle plugins. As in, using the
gradleApi()
dependency or applying the
java-gradle-plugin
plugin.
e
similar applies to writing precompiled script plugins
I haven't had issues with non-Groovy non-script plugins, though. or non-Groovy script plugins, for mat matter
m
I'm using
dev.gradleplugins:gradle-api
(doc) and sources are downloaded alright. Not sure about
gradleApi()
, I think that used to work as well but I stopped using that because I very rarely need to target the same Gradle as the one I am building with
j
I will try that later today. Thank you!
It looks like Nokee stopped maintaining this at Gradle 8.11.1, so there is no Gradle 8.13 API dependency to use. 😭
m
There's sometimes a bit of delay but it's eventually consistent 🙂
Ping @daniel are those artifacts still maintained?
d
Yes, they are. I was just being swarmed with work and other tasks. I have a prototype that would render this obsolete but I didn't have a chance to finish it yet.
❤️ 2
m
Awesome! Thanks for all the work maintaining that, this is super helpful 🤗❤️
👆 1
d
Let me release them now.
🚀 2
party gradlephant 2
j
Papa bless 🙏 you folks are awesome
v
This should hopefully make the whole re-publishing of Nokee folks unnecessary: https://github.com/gradle/build-tool-roadmap/issues/70
🚀 1
With 8.14 an experimental first step will already be published: https://github.com/gradle/gradle/issues/29483
party gradlephant 1
j
Ahh, that is very nice. But yeah, at the current moment for me it's just that the Gradle API that's provided in Gradle itself doesn't have any sources so I have to manually look up symbols in online docs. I would assume this solves that as well.
d
Finally some movement on that feature. 🙃
v
Actually, IntelliJ is able to provide you with the sources and JavaDoc even without the Nokee re-publish
I just tried it.
I navigated to a Gradle class
It showed the decompiled file
d
Note, the source jar for my gradle-api for some of the latest Gradle is broken. The newer publication will have those fixed. If needed, I will republish the older one, but I would rather move to a more general solution.
v
I told it to "Download ..." in the header and even though
gradleApi()
is used, it downloaded the proper sources and was then also able to display the JavaDocs
j
That's probably a new 2025.1 feature because I don't recall seeing that before. I wonder if there's a way to enable it by default.
Normally I have the actual Gradle project itself on another IDE window but sometimes it causes my IDE to die in the process (Gradle is a big project and eats memory just by existing)
d
There is some support that was added but in my experience it was flaky. Maybe they fixed it in the latest intellij. 🤷
j
That'd be great. Though I'll probably need to rummage around IntelliJ settings. Hopefully it's not an Ultimate-exclusive 🥲
😆 1
In the worst case scenario I'll use the Nokee re-publish or keep doing my scuffed "Gradle in another window" method.
e
the "download sources" button is new, as part of work on speeding up the IDE IIRC. previously they'd be automatically downloaded and indexed
I think whatever you're running into may be unique to your setup because I've seen navigating to gradle sources from plugin sources work fine for at least the past few years
j
I'm unwilling to accept my setup as cursed just yet, as I've had this problem even on my last computer which ran Windows. Currently on Fedora 41. And my buildscript is as basic as it can get, even using the template from the Gradle docs has this issue.
v
> That's probably a new 2025.1 feature because I don't recall seeing that before. I wonder if there's a way to enable it by default. > Hardly, I'm not on 2025.1 yet, and it works like that for quite some time, I just verified it still works before writing. > Normally I have the actual Gradle project itself on another IDE window but sometimes it causes my IDE to die in the process (Gradle is a big project and eats memory just by existing) > You can either increase the IDE memory if you have enough RAM, it you can also just attach the checked out sources to the Gradle classes if the download option doesn't work for you. > the "download sources" button is new, as part of work on speeding up the IDE IIRC. previously they'd be automatically downloaded and indexed > Iirc it was always there, they just changed that they are downloaded my default, but you could have disabled the auto-downloading by default before of I'm not misremembering.
j
You can either increase the IDE memory if you have enough RAM, it you can also just attach the checked out sources to the Gradle classes if the download option doesn't work for you.
Yeah, force-feeding IntelliJ 8GB has been the play for me so far. I'm still not getting auto-downloaded sources so for now I'll just accept my cursed setup and continue doing what I've been doing. Not the end of the world.