We have a complicated, multi-module project that for various reasons must be run with 'gradle bootRun' and not 'grails run-app'. With 'grails run-app' it is easy to run in an https environment locally by using 'grails run-app -https', but this does not work for gradle bootRun and I could not find an obvious equivalent. Is there something I can add to my build file, or pass as a parameter, to mimick the -https behaviour of grails run-app when running locally on a developer machine?
EDIT: I'm using the default embedded servlet container (Tomcat)
I was able to solve this with the following steps:
Create a local keystore as per the instructions at https://tomcat.apache.org/tomcat-8.0-doc/ssl-howto.html#Configuration - in particular this command (using 'mysecret' when prompted for a password, this is your choice obviously)
$JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA -keystore ./localkeystore
Copy the generated localkeystore
file into the root of my project alongside build.gradle
Add the following block to build.gradle:
-
bootRun {
systemProperty 'server.port', '8443'
systemProperty 'server.ssl.enabled', 'true'
systemProperty 'server.ssl.key-store', './localkeystore'
systemProperty 'server.ssl.key-store-password', 'mysecret'
systemProperty 'server.ssl.key-password', 'mysecret'
}