https://kotlinlang.org logo
Title
c

Clint Checketts

12/23/2019, 11:55 PM
I just upgraded from 5.2.1 to 6.0.1, using the Kotlin DSL and I had some code in my settings.gradle.kts that is now broken:
rootProject.name = "example"

val mavenUser: String by settings
val mavenPassword: String by settings

pluginManagement {
  repositories {
    maven {
      url = uri("<https://myrepo>")
      authentication { create<BasicAuthentication>("basic") }
      credentials {
        username = mavenUser
        password = mavenPassword
      }
    }
  }
}
Specifically the
mavenUser
and password in the credentials block is now an ‘unresolved reference’
Any ideas on how I can change it to look up the username/password for my repo?
s

serebit

12/24/2019, 12:28 AM
`settings.gradle.kts`is now evaluated before
buildSrc
.
c

Clint Checketts

12/24/2019, 12:31 AM
Yeah. I figured it was some fundamental change like that. I need to look up credentials to authenticate against my internal repository for my plugins. How can I access properties from
-P
or
~/.gradle/gradle.properties
?
After pondering the release note for v6 (https://docs.gradle.org/current/userguide/upgrading_version_5.html#classes_from_buildsrc_are_no_longer_visible_to_settings_scripts) I found out that I just needed to move the
mavenUser
part into the
pluginManagement
block.