I have Spring Boot project with Gradle and I had to put some parameters in the gradle file so I can build to project with different environments.
So for example I use
gradlew build docker -Penv_name=prod
And I get a custom docker name
docker {
dependsOn build
name "gcr.io/app-${env_name}/app"
}
It's all good but the problem is that I get errors from intelliJ
Could not get unknown property 'env_name' for root project
Adding def env_name = ""
obviously solves the problem.
Is there a way to define env_name
only if it's not already defined, or maybe set default value to it somehow?