In build.gradle I Know you can do this
ext {
dbUsername = System.getenv("DB_USER").toString()
dbPassword = System.getenv("DB_PASS").toString()
libsUserNameNew = System.getenv("LIBS_USERNAME_NEW").toString()
libsPassNew = System.getenv("LIBS_PASS_NEW").toString()
gitShortTag = System.getenv("SHORT_SHA").toString()
repoName = System.getenv("REPO_NAME").toString()
group = "app.test.customerservicepoc"
mainClass = "app.test.customerservicepoc.CustomerServicePOC"
}
How can I achieve the same using build.gradle.kts
This is what I have tried
var dbUsername =""
var dbPassword =""
var LibsUserNameNew = ""
var LibsPassNew = ""
var gitShortTag = ""
var repoName = ""
and then
ext {
dbUsername = System.getenv("DB_USER").toString()
dbPassword = System.getenv("DB_PASS").toString()
kyoskLibsUserNameNew = System.getenv("LIBS_USERNAME_NEW").toString()
LibsPassNew = System.getenv("LIBS_PASS_NEW").toString()
gitShortTag = System.getenv("SHORT_SHA").toString()
repoName = System.getenv("REPO_NAME").toString()
group = "app.test.mms"
}
during build I end up getting errors
- What went wrong: 945 Cannot invoke "String.toString()" because the return value of "org.gradle.internal.classpath.Instrumented.getenv(String, String)" is null
I am migrating the project to kotlin gradle
, how can I define the variables in kotlin gradle?