Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/kotlin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Kotlin 在使用';多拉斯特';在梯度任务中_Kotlin_Debugging_Gradle_Intellij Idea_Cucumber - Fatal编程技术网

Kotlin 在使用';多拉斯特';在梯度任务中

Kotlin 在使用';多拉斯特';在梯度任务中,kotlin,debugging,gradle,intellij-idea,cucumber,Kotlin,Debugging,Gradle,Intellij Idea,Cucumber,在Kotlin+Gradle+IntelliJ项目中,我注意到我可以使用Gradle.build中定义的以下任务之一运行\debug(命中断点)我的主类: // debug works!! task debugTest1(type:JavaExec) { group = "Execution" description = "Run the main class with JavaExecTask" classpath = sourc

在Kotlin+Gradle+IntelliJ项目中,我注意到我可以使用Gradle.build中定义的以下任务之一运行\debug(命中断点)我的主类:

// debug works!!
task debugTest1(type:JavaExec) {
    group = "Execution"
    description = "Run the main class with JavaExecTask"
    classpath = sourceSets.main.runtimeClasspath
    main = "temp.Main"
}

// debug works!
task debugTest2() {
    javaexec{
        group = "Execution"
        description = "Run the main class with JavaExecTask"
        classpath = sourceSets.main.runtimeClasspath
        main = "temp.Main"
    }
}

但是,在添加“doLast”时,IntelliJ中的调试会运行,但会忽略断点:

// debug ignores breakpoint!
task debugTest3() {
    doLast {
        javaexec{
            group = "Execution"
            description = "Run the main class with JavaExecTask"
            classpath = sourceSets.main.runtimeClasspath
            main = "temp.Main"
        }
    }
}
我的build.gradle文件与此类似

plugins {
    //id 'org.jetbrains.kotlin.jvm' version '1.3.72'
    id 'org.jetbrains.kotlin.jvm' version "1.4.20-RC"
}

group 'MY-COMPANY-GROUP'
version '1.0-SNAPSHOT'


repositories {
    mavenCentral()
}

allprojects {
    compileJava { options.encoding = "UTF-8" }
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib"
}
我的临时主文件(Main.kt):

我的规格是:

  • 爪哇:11
  • 操作系统:Windows 10
  • Intellij:Intellij IDEA 2020.2.3,10月6日构建
可能与…有关可能与…有关
@file:JvmName("Main")

package temp


fun main(args: Array<String>) {
    println("Hello World!")
    Object.setProperties();
    print("Object.setProperties() = ${Object.property1}")
}
task cucumber() {
    dependsOn assemble, testClasses
    doLast {
        javaexec {
            main = "io.cucumber.core.cli.Main"
            classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
            args = [/*'--plugin','pretty', */
                    '--glue', 'COMPANY-PACKAGE.cucumber.steps', 'src/test/resources/features',
                    '--tags','not @inProgress']
        }
    }
}