Hello everyone
I’ve been working with Gradle for a few days so I’m kind of newbie.
In a bigger Gradle file, I have a task to copy some files from different folders (each file: different origin, different destination). I already checked that creating a single task for each copy, works but I was looking for a more “clean” way to do it so I came with this:
task copyFiles (type: Copy, dependsOn: otherTask) {
copy {
from ("${buildDir}/wrapper-linux-${jswArc}-${jswVersion}/bin/wrapper")
into felix_tree + "/bin"
}
copy {
from ("${buildDir}/wrapper-linux-${jswArc}-${jswVersion}/lib/libwrapper.so")
into felix_tree + "/lib"
}
copy {
from ("${buildDir}/wrapper-linux-${jswArc}-${jswVersion}/lib/wrapper.jar")
into felix_tree + "/lib"
}
copy {
from ("./felix")
into felix_tree + "/bin"
}
copy {
from ("./config.properties")
into felix_tree + "/bin/conf"
}}
At the beginning I wasn’t using the copy{} structure, so all the files move to the first “into” destination, but using this structure Gradle works in a very weird way. The first time I execute the task, only the last two copy are made, and if I execute the same task immediately one more time, all the copies are made. And no idea why this is working like this
Probably my way is not the better way to do such task, but I don’t want to use five different task for such a simple actions. Is there any better way to do this?
Thanks