2013-05-08 102 views
0

我試圖推送到Gradle任務中的遠程git倉庫。我發現的最好的方法是使用插件Gradle-Git在這裏找到:https://github.com/ajoberstar/gradle-git自定義Gradle任務失敗 - 無法找到GitPush

我基本上只是試圖能夠運行推送任務,然後從那裏去配置它在我的項目中使用。

這是我的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

回答

1

您還沒有跟上的插件站點上的說明

爲了增加一些東西到構建本身,你需要有一個buildscript

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

謝謝,這個作品完美!我認爲,因爲我已經有了存儲庫和依賴關係塊,我可以將這些行添加到這些部分,而不是創建單獨的構建腳本塊。 – twbbas 2013-05-08 18:05:37

相關問題