How do I map a plugin's extension property to a copy task's excludes?

I’m currently working on the Lazybones Gradle plugin. The plugin registers an extension using a custom LazybonesConventions class. I then use convention mappings to map the extension properties to task properties. This was working until I tried to map to a Zip task’s ‘excludes’ property:

def task = project.tasks.create(taskName, Zip)
task.with {
    conventionMapping.map("baseName") { tmplName + project.extensions.lazybones.packageNameSuffix }
    conventionMapping.map("destinationDir") { project.extensions.lazybones.packagesDir }
      includeEmptyDirs = true
    version = project.file("$tmplDir/VERSION").text.trim()
      from tmplDir
    conventionMapping.map("excludes") { project.extensions.lazybones.packageExcludes }
}

The exclusions don’t appear to work. If I set the ‘excludes’ property to a literal list, those files are excluded as expected. Is there any way to achieve what I want? Is the ‘excludes’ property special in some way such that the convention mapping doesn’t work?

For what it’s worth, it seems in this case I can set the property directly:

excludes = project.extensions.lazybones.packageExcludes

Convention mapping won’t work for ‘excludes’ because it’s not really a property but a method that configures the underlying CopySpec:

https://github.com/gradle/gradle/blob/43881ad9ff0125fe767437b91c0ce1d40d599248/subprojects/core/src/main/groovy/org/gradle/api/tasks/AbstractCopyTask.java#L288

Thanks for the quick reply. I suspected as much. Is there a best practice alternative?

Not that I know of, sorry.