我正在尝试在 Gradle 任务中推送到远程 git 存储库。我发现的最好方法是使用这里找到的插件 Gradle-Git:https ://github.com/ajoberstar/gradle-git
我基本上只是想能够运行推送任务,然后从那里配置它以在我的项目中使用。
这是我的 build.gradle 脚本的样子。
apply plugin: 'eclipse'
apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'base'
import org.ajoberstar.gradle.git.tasks.*
repositories {
mavenCentral()
maven {
url "[my custom repository repo]"
}
}
dependencies {
compile 'org.ajoberstar:gradle-git:0.4.0'
}
task push(type: GitPush) {
println "Test"
}
我的错误是
FAILURE: Build failed with an exception.
* Where:
Build file '[my_path]\build.gradle' line: 19
* What went wrong:
A problem occurred evaluating root project 'Name'.
> Could not find property 'GitPush' on root project 'Name'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
并使用 --stacktrace 运行会在此处生成异常日志:http: //pastebin.com/uqjf5U5k