我正在尝试根据 buildVariant 更改 repoKey。例如,我想为发布版本设置 repoKey = "ProdRepo",为调试版本设置 repoKey = "DebugRepo"。
例子:
artifactory {
contextUrl = "http://url.com"
publish {
repository {
repoKey = *ProdRepo/DebugRepo* //based on buildType
username = properties.getProperty('artifactory_username')
password = properties.getProperty('artifactory_password')
maven = true
}
defaults {
publishArtifacts = true
publishBuildInfo = true
publishPom = true
publications('aar')
}
}
}
请帮忙。
最佳答案
好的,尝试添加一个变量,如:
def b_type
在您的
buildTypes
部分为每种类型赋予一个值:buildTypes {
debug {
...
b_type = "Debug"
}
release {
...
b_type = "Prod"
}
}
最后在你的 key 中使用它:
repoKey = "${b_type}Repo"
关于android - Gradle - 基于 buildType 更改 Artifact repoKey,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48041374/