I'm new to gradle any trying to package a little project of mine. When building my distribution package, the structure is as follows:
my-project.zip
|
+- my-project
|
+- bin (containing start scripts)
+- lib
+- xyz (folders from src/dist)
What I want to achieve is having the start scripts in the project root folder instead of the bin subfolder (I know that this is some kind of convention, but I also like to start my application from within the application folder):
my-project.zip
|
+- my-project
|
+- lib
+- xyz (folders from src/dist)
+- my-project.bat
+- my-project.sh
Is this possible?
I've tried setting tasks.startScripts.outputDir but with no success (scripts were completely removed from the distribution package).
Update
In addition to lu.koerfer's answer I had to modify the start scripts to take into account the changed APP_HOME:
startScripts {
startScripts.applicationName = artefactsBaseName
doLast {
def windowsScriptFile = file getWindowsScript()
def unixScriptFile = file getUnixScript()
windowsScriptFile.text = windowsScriptFile.text.replace('set APP_HOME=%DIRNAME%..', 'set APP_HOME=%DIRNAME%')
unixScriptFile.text = unixScriptFile.text.replace('cd "`dirname \"$PRG\"`/.." >/dev/null', 'cd "`dirname \"$PRG\"`" >/dev/null')
}
}