, , jihor. , - :
startScripts {
def gen = unixStartScriptGenerator
gen.template = resources.text.fromString(
gen.template.asString().replaceFirst('(?=\nDEFAULT_JVM_OPTS=.*?\n)') {
'\nJAVA_OPTS="\\$JAVA_OPTS "\'"-Dprogname=\\$0"\''
})
// TODO: do something similar for windowsStartScriptGenerator
}
replace
replaceFirst
, . , lookahead, , . ( groovy replaceFirst
, , , . , , .)
, :
JAVA_OPTS="$JAVA_OPTS -Dprogname=$0"
- :
JAVA_OPTS="$JAVA_OPTS "'"-Dprogname=$0"'
, $0
(, ), script $JAVA_OPTS
eval set --
.
( - , Windows, , .)