8

Trying to git commit a repo through a task in build.gradle. However, the error persists and I am not able to fix it.

LOG:

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

Build.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) 

}
Sidharth
  • 1,402
  • 2
  • 16
  • 37
  • The given build script code does not produce the error message you are seeing. I am using Gradle 3.0. – Benjamin Muschko Sep 25 '16 at 15:56
  • But it is producing this error in my case. any solution or suggestion. @BenjaminMuschko – Sidharth Sep 26 '16 at 03:52
  • Please provide a project on GitHub including the Gradle Wrapper that reproduced the issue. – Benjamin Muschko Sep 26 '16 at 11:58
  • @BenjaminMuschko U mean using just this code it should commit the changes to git repo from local repo – Sidharth Oct 04 '16 at 06:30
  • Not just the code you provide here but also the Gradle Wrapper files so I can execute the build with a specific version of Gradle without having to install the runtime. Please refer to the Gradle user guide for more information. – Benjamin Muschko Oct 04 '16 at 12:17

0 Answers0