Writing Gradle Plugin

I have a broken plugin which is written in Java, and its author, abandoned it without a trace, so I need
to figure out how to write Gradle plugin.

doing that I hit a few road blocks:

1 - Every single sample in custom_plugins documentation are either Kotlin or groovy, Is there a place that I can find Java version of these things?

2- I can’t figure out which part belongs to host code (gradle plugin) and which part goes to client app (the one that will be using the plugin)

3- Troubleshooting document is totally outdated. there is no remote option in IdeaJ, it has been split to multiple under Firefox, Go, Jetty, Tomcat, … and none of them looks like what I would need to debug task code. Even after figuring out that, I’m not sure which app, I would need to start debugging? the host or client?

If I manage to figure out these mentioned above, I will reach the point that I will need more advanced topics in this matter. e.g. how to read list of files in project, How to pass a file to an external executable (jar), or how to capture output of the console and put it in the Idea log screen.

Appreciate any source or document that is more clear and usable.

1 Like

Answering your 3rd question

In the troubleshooting the part under remote debugging should work just fine:
https://docs.gradle.org/current/userguide/troubleshooting.html#sec:troubleshooting_build_logic

Also a blog post on medium

And some discussion on the forum:

Basically you need to

  1. Start the host (code containing plugin source) in remote debugging state, which will wait and listen that the client executes Gradle tasks
  2. Start the application that will send events to specific host/port or memory location that the host will pick up and will be able to debug the plugin code that way.

I agree that it would be the best way if you could actually see the whole process. Maybe I can make a recording of debugging as an example so you can see all of the steps. I suppose you are using IntelliJ.
Is plugin
A) binary plugin? totally separated project or
B) are you having a precompiled plugin in a buildSrc directory in the same project?

Would there be any chance that you could share the code?

1 Like