【问题标题】:uploadArchives build both debug and releaseuploadArchives 构建调试和发布
【发布时间】:2016-06-16 08:55:07
【问题描述】:

我的 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。

有没有办法防止这种情况发生?这没什么大不了的,但最好只构建我指定的版本;即 uploadDebugArchivesuploadReleaseArchives 会很好......

【问题讨论】:

    标签: android gradle android-gradle-plugin


    【解决方案1】:

    请看这里:http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Library-Publication

    defaultPublishConfig 设置为您要发布的构建类型。

    【讨论】:

    • 谢谢。但是据我了解,您只会发布一个,即您指定的那个。我们想同时发布两者,但是当我们指定发布构建或调试构建时。不是在同一时间(即我们有快照“调试”),我们发布的频率比发布的频率高。
    • >不是同时这不意味着你只发布一种构建类型吗?
    • 是的,一次是的。快照比发布更频繁。
    • 已弃用。是否有其他解决方案?
    猜你喜欢
    • 1970-01-01
    • 2014-03-05
    • 2018-02-04
    • 1970-01-01
    • 2022-01-03
    • 1970-01-01
    • 1970-01-01
    • 2019-06-15
    • 2010-10-15
    相关资源
    最近更新 更多