Best-practice Gradle setup for Maven&Gradle plugin?

Hi all,

I want to code a plugin that takes some Java-style pseudocode and generates Java sources from it.

I need help setting up a Gradle project that follows best practices, because this goes beyond my Gradle experience in multiple ways at once, which is a recipe for something that will never work.
Normally I’d just google something, but given that best practices for Gradle have been changing as new features, mechanisms, and even programming languages have added, I am at a loss finding out which suggestions are outdated.

Here’s the list of things to consider:

  • I want to create both a Maven and a Gradle plugin. (Company still uses Maven, so there.)
    This probably means I need (at least) three subprojects: Maven plugin, Gradle plugin, common plugin code.
  • Do I need unit tests for the two plugin subprojects? Can these be done within the plugin project, or do I have to put them into separate test subprojects?
  • I’d like to write the Gradle configuration in Kotlin, but I haven’t done anything with Kotlin yet. (Or maybe I should just stick with Java, just to avoid having to learn yet another thing - but then Gradle doesn’t offer Java and, no?)
  • I need to publish to Maven Central.
  • The plugins need to integrate as seamlessly as possible with existing IDEs (Eclipse and IntelliJ being the only blobs I have on my radar currently).
    • Ideally, they’d show the Javadoc of the generated code, and fall back to the Javadoc from the Java-style pseudocode if the plugin didn’t run yet
      If that’s even possible, that is. I haven’t written any IDE integration in my life.
  • A lot has changed. Recipes that worked well five years ago are hopelessly outdated today. I’ll have to relearn parts of Gradle.
  • No legacy setup to consider. This is a clean-slate project.

A readymade skeleton setup would give me instant gratification, a recipe for building the setup would be fine, explanations about the How and Why greatly appreciated.