I have the following task to bundle my application:
tasks.register<Tar>("bundleApp") {
archiveFileName = "myapp.tar"
dirPermissions { unix("0750") }
into("webapps/myapp") {
with(tasks.war.get())
}
}
Directories specified in into() and directories created internally by the War task take the default permissions, instead of the ones specified in the task.
❯ tar -tvf myapp.tar | grep 'drwxr-xr-x'
drwxr-xr-x 0/0 0 2026-09-06 13:39 webapps/
drwxr-xr-x 0/0 0 2026-09-06 13:39 webapps/myapp/
drwxr-xr-x 0/0 0 2026-09-06 13:39 webapps/myapp/META-INF/
drwxr-xr-x 0/0 0 2026-09-06 13:39 webapps/myapp/WEB-INF/
drwxr-xr-x 0/0 0 2026-09-06 13:39 webapps/myapp/WEB-INF/classes/
drwxr-xr-x 0/0 0 2026-09-06 13:39 webapps/myapp/WEB-INF/lib/
I also tried setting the permissions on the AbstractArchiveTask, but that didn’t make any difference. Is there a way to set all directory permissions consistently?