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
Gradle exec任务因“;execCommand==null”;_Gradle_Kotlin - Fatal编程技术网

Gradle exec任务因“;execCommand==null”;

Gradle exec任务因“;execCommand==null”;,gradle,kotlin,Gradle,Kotlin,我试图在build.gradle.kts上创建一个版本缓冲和标记创建者,但是我遇到了这个错误,有人能帮我吗?谢谢 FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':gitTag'. > execCommand == null! 我的身材.gradle.kts tasks { val gitIsDirty by registering(Exec::cla

我试图在build.gradle.kts上创建一个版本缓冲和标记创建者,但是我遇到了这个错误,有人能帮我吗?谢谢

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':gitTag'.
> execCommand == null!

我的身材.gradle.kts

tasks {
    val gitIsDirty by registering(Exec::class) {
        description = "Fails if git has uncommitted changes."
        group = "verification"
        commandLine("git", "diff", "--quiet", "--exit-code")
    }

    val gitTag by registering(Exec::class) {
        description = "Tags the local repository with version ${project.version}"
        group = PublishingPlugin.PUBLISH_TASK_GROUP
        dependsOn(gitIsDirty)
        if (isRelease) {
            commandLine("git", "commit", "-am", "Publishing version ${project.version}")
            commandLine("git", "tag", "-a", project.version, "-m", "Version ${project.version}")
            commandLine("git", "push", "origin", "${project.version}")
        }
    }

    val publishLocalMajor by registering(Exec::class) {
        group = PublishingPlugin.PUBLISH_TASK_GROUP
        dependsOn(incrementMajor, gitTag,publishToMavenLocal)
    }
}

如果您在没有
if(isRelease)
条件的情况下编写
commandLine()
是否有效?是的,这是gradle.startParameter.taskNames中的var
var isRelease=“release”