Pass system property in a Gradle Task

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

Tags: #gradle #spock #geb #grails #groovy #java #wordpress #woocommerce #micronaut