Gradle/Java start-up script for Linux not executable

Viewed 207

There is a Java/Gradle project that uses the plugins java and application.

plugins {
    id 'java'
    id 'application'
}

The application plugin creates two scripts, one is .bat for Windows, and the other is a sh script for Linux (and Mac OS X), and places these two scripts into the distribution .zip file.

The problem is that the generated startup script for Linux has no "executable" attribute (even though the app is built under Linux). Having to do chmod a+x is annoying.

Question: How do I make Gradle make the generated startup script executable? (Preferably, in a platform-independent way.)

1 Answers

The executable attribute is there, but it is not shown, neither by Midnight Commander (shown as cleared) nor by the built-in archive viewer (not shown). Midnight Commander clears this attribute when it unpacks the files; zip and the built-in archive viewer correctly restore the executable attribute.

Nevertheless, this will work only under Linux (and probably OSX).

Related