Project layout advice for making both a Gradle and a Maven plugin?

Hi all,

I want to build a plugin that will exist in two forms, foo-gradle-plugin and foo-maven-plugin.

In Maven, I’d have to create separate subprojects for each artifact I want to deploy in the end; can I put it all into a single Gradle project? Should I do that?

Things that may affect what’s advisable:

  • The plugins will share most code, so I’ll have three modules: foo-gradle-plugin, foo-maven-plugin, foo-common.
  • For now, the plan is to publish foo-gradle-plugin and foo-maven-plugin on Maven Central.
    If demand or technical requirements mterialize, I’m open to publishing foo-common, but I’m happy if it is just a shared-code container for the build.
  • There will be unit testing. (Writing the unit tests is easy, but technicalities around unit tests can affect the overall setup I suppose.)

I have tried to collect advice on my own, but the Gradle pages give me a multitude of moving parts but no instructions how to assemble them (there are templates for many project types but I couldn’t find this use case), and my Internet searches returned tons of pages but most were written for other versions of Gradle where the modern facilities aren’t available, so I can’t really go by these.