Gradle de tareas Dependencias
-
04-10-2019 - |
Pregunta
¿Cómo es posible hacer esto en Gradle: por ejemplo. desee utilizar HTTPBuilder
en una tarea.
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??
}
Solución
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'
}
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow