2014-12-22 70 views

回答

1

它可以以完全相同的方式完成。在這裏,你已經工作的例子:

buildscript { 
    repositories { 
     mavenCentral() 
    } 
    dependencies { 
     classpath 'com.github.tomakehurst:wiremock:1.52' 
    } 
} 
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig 
import com.github.tomakehurst.wiremock.* 
apply plugin: 'java' 

task someTask { 

    doLast { 
     WireMockServer wireMockServer = new WireMockServer(wireMockConfig().port(8089)) 
     println wireMockServer 
    } 
} 

如果外部庫是build.gradle本身就應該被添加作爲一個依賴於buildscript塊使用。

+0

完成上述操作後,我得到錯誤:執行失敗的任務'projectname:someTask'INSTANCE – naveen

+0

什麼錯誤?請粘貼它。 – Opal

+0

錯誤:執行任務''>> INSTANCE – naveen

相關問題