Custom start script doesnt work

I am running gradle 3.5
I have to overwrite the start script with a custom start script that adds a few env variables and command line args but the distZip doesnt seem to pick this up. It continues to use the default task and creates the default sh file. The below setting doesnt seem to have an effect at all.

I have been trying this morning. I upgraded gradle 3.3 to 3.5 but that didnt help. I tried putting the startscript on the project dir. Tried a full overwrite of createStartScripts and that didnt help either.

task createStartScripts(type: CreateStartScripts) {
    unixStartScriptGenerator.template = resources.text.fromFile("$projectDir/scripts/unixStartScript.txt")
    doLast {
        println "within custom startScripts task"

Any help to get this sorted much appreciated.


The application plugin creates a task of type CreateStartScripts, but called startScripts. Your example code creates a completely unrelated task of the same type, but would not execute, override, or configure anything used by the distZip task. It’s also missing required properties if you did execute it.

If you just want to change the unixStartScript template, you want to configure the generator template of the existing startScripts task:

startScripts {
    unixStartScriptGenerator.template = resources.text.fromFile("scripts/unixStartScript.txt")