Pass system property in a Gradle Task

Sergio del Amo Mon, 25 Mar 2019 10:00:00 GMT

If you created a Micronaut App with Gradle (the default build tool) used by Micronaut CLI, you may want to start your app in a particular Micronaut environment. You can supply an environment with the system property micronaut.environments. Modify your build.gradle file

run {
systemProperty "micronaut.environments", System.getProperty('micronaut.environments')

Then you can start the app with:

$ ./gradlew -Dmicronaut.environments=dev run