So I'm using Gradle Kotlin DSL, I want to know if it's possible to read gradle properties inside settings.gradle.kts
?
I have gradle.properties
file like this:
nexus_username=something
nexus_password=somepassword
I've done it like this, but still can't read the properties.
dependencyResolutionManagement {
repositories {
mavenCentral()
google()
maven { setUrl("https://developer.huawei.com/repo/") }
maven { setUrl("https://jitpack.io") }
maven {
setUrl("https://some.repository/")
credentials {
val properties =
File(System.getProperty("user.home")+"\\.gradle", "gradle.properties").inputStream().use {
java.util.Properties().apply { load(it) }
}
username = properties["nexus_username"].toString()
password = properties["nexus_password"].toString()
}
}
}
}