How preserve the xattrs (extended attributes) of the files in a Tar archive?


I’m trying to create a tar archive where some of the files have some xattrs (extended attributes) set (like Linux capabilities for example), it would be nice if they are preserved. GNU Tar seem to have a --xattrs flag that enables this usecase. Does Gradle’s Tar task have something similar?