How do you run micronaut from gradle with local properties

Command below works for unix, probably it should work also for windows:

MICRONAUT_ENVIRONMENTS=local gradle run

or use gradle wrapper

MICRONAUT_ENVIRONMENTS=local .\gradlew.bat run

P.S. also, you can find the same approach for Spring Boot


My approach is to add a gradle task.

task runLocal(type: JavaExec) {
   classpath = sourceSets.main.runtimeClasspath
   main = "dontdrive.Application"
   jvmArgs '-Dmicronaut.environments=local'
}

then start with:

./gradlew runLocal