Pass system property in a Gradle task

March. 25, 2019 #geb #gradle

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