I am trying to add a dependency which is present in a zip file hosted in server.
I need to download the zip file and extract it and add a jar file from the extracted location as a dependency.
I am trying the following.
task testTask(type: Sync) {
def extractDir = “tmpDeps”
ext.extractedJars = fileTree(extractDir) {
include “/dist/test.jar”
builtBy “testTask”
}
dependsOn configurations.testzip
from {
configurations.testzip.collect{tarTree(it)}
}
into extractDir
}
When I run the build I get this error
Could not get unknown property ‘testTask’ for task set.
I am not sure how to fix this issue.
I am looking at the documentation but could not figure out anything.
Please help with this issue.
Thanks for you solution.
I tried this and I see that the jar file is being extracted to the intended location.
But when I run dependencies task I don’t see the jar file in the list of dependencies output.
Build fails with the error missing classes from the dependency jar.
Am I missing something? Is there any other way to pass on files list from a task to compile dependency.