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

Leave a Reply

Your email address will not be published. Required fields are marked *