There’s probably an easier way, but the only way I know is to iterate through all files in the file tree, and add only normal files (no sub-directories):
copy {
fileTree('lib').each { file ->
if (file.isFile())
from file
}
}