所以我正在使用 Gradle Kotlin DSL,我想知道是否可以读取里面的 gradle 属性settings.gradle.kts?
我有gradle.properties这样的文件:
nexus_username=something
nexus_password=somepassword
Run Code Online (Sandbox Code Playgroud)
我已经这样做了,但仍然无法读取属性。
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()
}
}
}
}
Run Code Online (Sandbox Code Playgroud) 所以我尝试使用新的 Kotlin DSL 语法将 AppGallery connect gradle 插件添加到我的 android 项目中。但我收到这样的错误:
org.gradle.internal.exceptions.LocationAwareException: Build file 'D:\#KERJAAN\devbase\sample\build.gradle.kts' line: 3
Plugin [id: 'com.huawei.agconnect', version: '1.6.3.300'] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'com.huawei.agconnect:com.huawei.agconnect.gradle.plugin:1.6.3.300')
Searched in the following repositories:
Gradle Central Plugin Repository
Google
MavenRepo
maven(https://developer.huawei.com/repo/)
Run Code Online (Sandbox Code Playgroud)
我所做的就是为这样的插件添加存储库settings.gradle.kts:
org.gradle.internal.exceptions.LocationAwareException: Build file 'D:\#KERJAAN\devbase\sample\build.gradle.kts' line: 3
Plugin [id: 'com.huawei.agconnect', version: '1.6.3.300'] was not found in any …Run Code Online (Sandbox Code Playgroud) android gradle huawei-mobile-services huawei-developers appgallery-connect