How to transform the runconfiguration of IntellIJ to the gradle.build file?

I have the following problem:
When I run my gradle project in IntelliJ, it works fine.

But when I run the same project from command line, it doesn’t run.

I’m trying to translate the runconfig into the gradle.build file. But so far no success.
Can someone help me with this?

defaultTasks 'clean','test','aggregate'

repositories {
    mavenLocal()
    jcenter()
}

buildscript {
    repositories {
        mavenLocal()
        jcenter()
    }
    dependencies {
        classpath("net.serenity-bdd:serenity-gradle-plugin:2.0.70")
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'net.serenity-bdd.aggregator'
apply from: "$rootDir/gradle/libraries.gradle"


sourceCompatibility = 1.8
targetCompatibility = 1.8

/**
 * This is needed to make sure there are no Cucumber 2 dependencies in the classpath.
 */
configurations.all {
    resolutionStrategy {
        force "io.cucumber:cucumber-core:${cucumberVersion}"
    }
}
dependencies {
    compile libs.logback

    testCompile libs.test.cucumber.java,
            libs.test.cucumber.junit,
            libs.test.serenity.core,
            libs.test.serenity.screenplay,
            libs.test.serenity.junit,
            libs.test.serenity.screenplayWebdriver,
            libs.test.serenity.cucumber,
            libs.test.junit,
            libs.test.assertj

    compile group: 'net.lightbody.bmp', name: 'browsermob-proxy', version: '2.1.5', ext: 'pom'
    compile group: 'net.lightbody.bmp', name: 'browsermob-core', version: '2.1.5'
    compile group: 'de.sstoehr', name: 'har-reader', version: '2.1.4'
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.3.1'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.3.1'
}

test {
    testLogging.showStandardStreams = true
    systemProperties System.getProperties()
}

gradle.startParameter.continueOnFailure = true

test.finalizedBy(aggregate)

configurations {
    cucumberRuntime {
        extendsFrom testRuntime
    }
}

task cucumber() {
    dependsOn assemble
    doLast {
        javaexec {
            main = "cucumber.api.cli.Main"
            classpath = configurations.cucumberRuntime
            args = ['--plugin', 'pretty', '--glue net.serenitybdd.cucumber.actors net.persgroep.targetqa.starter.stepdefinitions', 'src/test/java/net/persgroep/targetqa', 'src/test/resources/features']

        }
    }
}

//Ensure the cucumber tests are executed as part of the build. Makes for a very pretty output.
build.dependsOn cucumber