Hello. First, this is not technically a bug, but this seemed like the most relevant place to post this. If it belongs elsewhere then I apologize.
I recently ported a heavily customized Ant-based build system to Gradle and one frustration I had involved the default behavior around start scripts as configured by the Application plugin.
-
The start scripts’ install/include location is not customizable. We have an existing distro layout that we want to keep, in which start scripts are at the root instead of
/bin
, but because this is not configurable you are left with two options:eachFile
(see #2) or disablingstartScripts
and including your own separately (then you hit #3). -
You can work around the lack of configurability by using an
eachFile
closure on your distribution to selectively modify the relative path just for the start scripts. This works for the zip/tar distributions, but causesinstallDist
(andinstallApp
) to fail (see #3). -
installDist
is hard-coded to runchmod a+x
on$destDir/bin/$appName
. This will cause the task to fail if the file doesn’t exist, perhaps because you moved it or you disabledstartScripts
.
What we ended up doing was
- disabling
startScripts
entirely (so the default scripts would not be included in any distributions) - including our own custom scripts as normal files in the distributions
- creating a dummy script before
installDist
and then deleting it and/bin
afterward (see here)
There are two ways things could be better:
- The bin dir could be set via a property, so that one could include custom scripts by customizing the output of
startScripts
but leave everything else as default, and/or - In case you want to simply disable
startScripts
and handle things yourself,installDist
could be made to not attempt to modify permissions of nonexistent files.