8

尝试通过 build.gradle 中的任务 git commit 一个 repo。但是,错误仍然存​​在,我无法修复它。

日志:

Caused by: groovy.lang.MissingPropertyException: Could not get unknown property 'Grgit' for task ':gitCommit' of type org.gradle.api.DefaultTask.
at org.gradle.internal.metaobject.AbstractDynamicObject.getMissingProperty(AbstractDynamicObject.java:85)
at org.gradle.internal.metaobject.AbstractDynamicObject.getProperty(AbstractDynamicObject.java:62)
at org.gradle.api.DefaultTask_Decorated.getProperty(Unknown Source)
at build_bxyru49cls20l44sy22y2a646$_run_closure5.doCall(C:\repos\test_project\build.gradle:148)
at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:590)
at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:571)
at org.gradle.api.internal.tasks.TaskMutator$1.execute(TaskMutator.java:77)
at org.gradle.api.internal.tasks.TaskMutator$1.execute(TaskMutator.java:73)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
... 60 more

构建.gradle:

import org.ajoberstar.grgit.*;

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'org.ajoberstar:gradle-git:1.5.1'
    }
}

task gitCommit(description:'Committing') << {
    def gg = Grgit.open(dir: '.')
    gg.add(patterns: ['.'])
    gg.commit(message: 'Changes')
    gg.push(force: true) 

}
4

0 回答 0