I use the gradle application plugin to generate the application folder.
The installApp
task provides a start script for me, but I have no idea how to set the jvm args from build.gradle
.
Some jvm args I needed, such as file.encoding
. I just modify the start script to set the DEFAULT_JVM_OPTS
variable
#!/usr/bin/env bash
##############################################################################
##
## MuzeeS3Deployer start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and MUZEE_S_DEPLOYER_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=" -Dfile.encoding=utf-8 "
If the args not set, my console cannot show messages well:
qty:MuzeeS3Deployer qrtt1$ ./build/install/MuzeeS3Deployer/bin/MuzeeS3Deployer d
2012/10/14 #U###12:02:03 SyncCommand main
ĵ#i: no aws credentials found at /Users/qrtt1/AwsCredentials.properties
When I set the encoding:
qty:MuzeeS3Deployer qrtt1$ ./build/install/MuzeeS3Deployer/bin/MuzeeS3Deployer d
2012/10/14 下午 12:04:19 SyncCommand main
警告: no aws credentials found at /Users/qrtt1/AwsCredentials.properties
I got the solution from @Peter. Finally, I make a minor changes to the scripts:
startScripts {
doLast {
unixScript.text = unixScript.text.replace('DEFAULT_JVM_OPTS=""', 'DEFAULT_JVM_OPTS="-Dfile.encoding=utf-8"')
windowsScript.text = windowsScript.text.replace('DEFAULT_JVM_OPTS=', 'DEFAULT_JVM_OPTS="-Dfile.encoding=utf-8"')
}
}