开发者

Gradle Task Dependencies

开发者 https://www.devze.com 2023-01-16 18:09 出处:网络
How on earth can I do this in gradle: eg. want to use HTTPBuilder in a task. build.gradle: repositories {

How on earth can I do this in gradle: eg. want to use HTTPBuilder in a task.

build.gradle:

repositories {
 mavenRepo urls: "http://repository.codehaus.org开发者_如何学编程"
}

configurations {
 testConfig
}

dependencies {
 testConfig 'org.codehaus.groovy.modules.http-builder:http-builder:0.5.0'
}

task someTaskThatUsesHTTPBuilder (dependsOn: configurations.testConfig) << {
     new HTTPBuilder()// <--this cannot be resolved/found??
}


To use a class directly in your build script, you need to declare the dependency as part of the script's classpath in the buildscript { } closure. For example:

buildscript {
   repositories {
       mavenRepo urls: "http://repository.codehaus.org"
   }
   dependencies {
      classpath 'org.codehaus.groovy.modules.http-builder:http-builder:0.5.0'
   }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消