I have a fairly simple requirement:
- Copy some dependencies to $buildDir/staging folder 2) zip the content of $buildDir/staging folder 3) Call a java class with the above folder as argument.
So far I am using this script:
// Copy the dependencies
task myPrepare << {
copy {
from configurations.myConf
into new File("$buildDir/staging").getPath()
}
}
// Zip the folder
task myAssemble(dependsOn: 'myPrepare', type: Zip){
from "$buildDir/staging"
}
// Call the java class
task myDeploy(dependsOn: 'myAssemble') << {
javaexec {
classpath = sourceSets.main.runtimeClasspath
main = 'com.test.MyClass'
args=["$buildDir/distributions"]
}
}
but this smells very much like ant and maybe there is a more gradle way to achieve the rather basic steps described above?
Basically it comes from the problem that zip cannot be called from a task like copy.