How to make my custom module generate a Maven/Gradle template in an IntelliJ plugin?

I have made a custom module here: Custom Module

It does everything as intended, but I am offering the ability to either create a Maven or Gradle plugin. So I essentially need to create the project using either of these frameworks, but I have no idea how to.

The docs are pretty difficult to comprehend. My current setup is a working project creation wizard with multiple steps.

How do I make sure the project they generate when clicking Finish after completing my steps will be either a blank Maven or Gradle project? Sharing any code, existing projects or anything to set me on my way will be much appreciated.