Skip to main content

Pass system properties down to Springboot in IntelliJ and Gradle

The most straight forward way to pass down Springboot config settings while developing to Gradle tasks is by environment variable (at least for me). E.g.:

SPRING_PROFILES_ACTIVE=dev gradle bootRun

Since IntelliJ does not allow passing environment variables down to Gradle tasks this does not work there. Thanks to Gradle we can make system properties available for tasks:

bootRun.systemProperties = System.properties

This way we can set in IntelliJ VM Options like -Dspring.profiles.active=dev for Gradle tasks.