Creating files using a copySpec?


Let’s assume

  1. I want to produce meta-data programmatically in the build.script
  2. I want to save the meta-data as a file and include in the artefacts I am publishing
  3. I have several artefacts and I use copySpec’s to define the content of these

Looking at the copySpec mechanism I don’t see any way in which I can actually use that to create the file?

Instead I end up with two options:

  1. Create a task and fiddle around with the task graph adding dependencies
  2. Use some groovy to create the file, taking into account whether this is ready or not (directories etc)

This seems quite awkward, is there no elegant solution which is in line with the intentions of using copySpec’s?