Equivalent of maven mojo's in gradle?

Our application is currently using maven, Application has a sub-project “scheduled-tasks” with a lot of Mojo’s.
These are complicated business related tasks like looking up values in a database and sending out emails.
it has dependencies to other sub-projects like “data-access”.
Project is using Kotlin.

Simplified overview:
– data-access
– repositories
– web-server
– scheduled-tasks

A sample class in scheduled-tasks:
import org.apache.maven.plugin.AbstractMojo
import org.apache.maven.plugins.annotations.Mojo

@Mojo(name = “notifyUsers”)
class NotifyUserTask : AbstractMojo {


And then execute:
mvn -pl myproject.scheduled-tasks myproject:scheduled-tasks:1.0:notifyUsers

Now i am porting this to gradle.
And i’m struggling to understand how to port these mojo’s.

Google search quickly returns references to gradle DefaultTask with @TaskAction.
I realize that i need to define these tasks in scheduled-tasks/build.gradle.kts
Then i realize that this file cannot reference classes inside scheduled-tasks/src.
I make a buildSrc project, but unable to add dependencies to other sub-projects in there.
I suspect this is a dead end.

So now i seem to be a bit stuck.
How do i set up the equivalent of mojo’s in gradle?

I’m mainly just looking for some way to create business-related functions in the codebase and then call that from the command line. Mojo’s fit this perfectly.