How can I run cucumber JVM test using custom RunCukesTest class instead of cucumber.api.cli.Main?

I have my own RunCukerTest class that extends AbstractTestNGCucumberTests, I do not know how to specify in the javaexec task of the gradle script to use it.
I have something like this, but I want to use my class instead of the cucumber CLI

task runFeatures() {
dependsOn assemble, compileTestJava
doLast {
try {
javaexec {
main = cucumber.api.cli.Main
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
args = [’–plugin’, ‘pretty’,
’–plugin’, ‘html:build/cucumber’,

you can use the Test task for testng instead of using javaexec and the RunCukerTest class that extends AbstractTestNGCucumberTests will be included in the execution.

Please take a look at this example.

task executeFeatures(type: Test) {
    // enable TestNG support (default is JUnit)
    useTestNG()
    options {
        useDefaultListeners = false
//        listeners << ''
        jvmArgs = ['-Dcucumber.options= ' +
                           '--glue org.company.app ' +
                           '--plugin pretty ' +
                           '--plugin json:build/cucumber/cucumber.json ' +
                           '--plugin rerun:build/cucumber/rerun.txt ' +
                           splitFeatureFolders(featureFolders) + ' ' +
                           cucumberOptions]
    }

    // show standard out and standard error of the test JVM(s) on the console
    testLogging.showStandardStreams = true

    // set JVM arguments for the test JVM(s)
    scanForTestClasses = false
    // ignoreFailures = true

    //turn off Gradle's HTML report to avoid replacing the reports generated by TestNG library:
    reports.html.enabled = false

    doLast {
        generateReport('build/cucumber/cucumber.json', 'build/cucumber/reports')
    }
}