I understand one could use “exclude” to exclude certain files in a folder from being archived. If it’s big project, it’s painful to explicitly list all files not being used any more. The scenario I am wondering if if I have some left-over files from previous build which I don’t need, is there a way for gradle to realize these files are not being generated by the current build and ignore them? Or do I need to a “clean” to make sure these files are deleted at the first place?
I don’t understand what you mean by “archiving”, but whether a task deletes previously generated files depends on the implementation of that task. For example, the ‘JavaCompile’ task does take care of this, to prevent stale class files.
Thanks for your quick reply. By archiving, I mean simply create a jar file or zip file. Would there be any way to track the files in the ‘from’ folder and ignore the ones from previous build. I guess I would like to mimic what JavaCompile is doing with class files.
You probably want to use the ‘Sync’ task instead of ‘Copy’.