Gradle 任务依赖关系
我到底怎样才能在 gradle 中做到这一点:例如。想要在任务中使用HTTPBuilder
。
构建.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??
}
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??
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要直接在构建脚本中使用类,您需要在 buildscript { } 闭包中将依赖项声明为脚本类路径的一部分。例如:
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: