# Application plugin very inflexible w.r.t. start scripts

**URL:** <https://discuss.gradle.org/t/application-plugin-very-inflexible-w-r-t-start-scripts/17444>\
**Category:** Bugs\
**Created:** [May 4, 2016, 2:15pm UTC](https://discuss.gradle.org/t/application-plugin-very-inflexible-w-r-t-start-scripts/17444 "2016-05-04T14:15:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![amake](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/amake/32/5097_2.png) [@amake](https://discuss.gradle.org/u/amake)\
**Post date:** [May 4, 2016, 2:15pm UTC](https://discuss.gradle.org/t/application-plugin-very-inflexible-w-r-t-start-scripts/17444/1 "2016-05-04T14:15:12Z")

</div>

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.

1. 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 disabling `startScripts` and including your own separately (then you hit #3).

2. 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 causes `installDist` (and `installApp`) to fail (see #3).

3. [`installDist` is hard-coded to run `chmod a+x` on `$destDir/bin/$appName`](https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/groovy/org/gradle/api/plugins/ApplicationPlugin.groovy#L76). This will cause the task to fail if the file doesn’t exist, perhaps because you moved it or you disabled `startScripts`.

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](https://github.com/omegat-org/omegat/blob/master/build.gradle#L328))

There are two ways things could be better:

1. 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
2. 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.
