How do I create a tar file from selected files from different directories?

I’ve added this task, but it doesn’t create anything. The variable files is an ArrayList of file names, and they exist.

task tgzTask(type: Tar) {
   include files
 baseName = 'test'
 destinationDir = file('.')
 extension = 'tgz'
 compression = Compression.GZIP
}
  println tgzTask.archiveName
println relativePath(tgzTask.destinationDir)
println relativePath(tgzTask.archivePath)
println files.size
files.each {println it}