Creating a tar containing a symlink

Is there any way in Gradle to create a tar archive that contains an entry which is a symbolic link that doesn’t actually exist on the build machine?

For example, if I’m an OS that doesn’t support symlinks, but I’m building for an OS that does support them, ideally it should be possible to define such an entry in the tarfile.

This feature has actually been requested frequently by Ant users for years now, but apparently it’s not trivial and nobody with the ability is interested in fixing.

So I was hoping somehow maybe Gradle already has such capability.

Ant bug for reference:


As far as I know, Gradle has no special code to assist in creating symlinks inside archives when building on platforms that don’t support symlinks: see docs - org.gradle.api.tasks.bundling.Tar