我的gradle脚本中有一个上传任务:
uploadArchives {
repositories {
mavenDeployer {
repository(url: "${nexusUrl}/content/repositories/apps-releases") {
authentication(userName: nexusUsername, password: nexusPassword)
}
snapshotRepository(url: "${nexusUrl}/content/repositories/apps-snapshots") {
authentication(userName: nexusUsername, password: nexusPassword)
}
pom.groupId = "$defaultApplicationId"
pom.artifactId = 'MyApp'
pom.version = applicationVersionName()
}
}
}
并从teamcity使用以下命令运行:
clean assembleDebug testDebugUnitTest crashlyticsUploadDistributionDebug uploadArchives
构建调试版本之后,似乎uploadArchives也正在构建发行版本。因此,当构建完成时,我既调试又发布了APK,作为从构建生成的工件。但是,如果我删除uploadArchives,它只会生成调试apk。
反正有防止这种情况发生的方法吗?没什么大不了的,但是只构建我指定的版本会很好。即uploadDebugArchives和uploadReleaseArchives会很好...
最佳答案
看到这里:http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Library-Publication
将defaultPublishConfig
设置为要发布的构建类型。