java - 防止将额外的 "app-unspecified.aar"上传到 Bintray

标签 java android android-library bintray

我正在尝试创建一个 android 库并将其发布到 Bintray 存储库。 但是在运行 bintrayUpload Gradle 任务时,有一个名为“app-unspecified.aar”的附加文件,该文件与原始 Artifact 一起上传到 Bintray。

enter image description here

发布.gradle

apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'

publishing {
    publications {
        library(MavenPublication) {
            groupId publishGroupId
            artifactId publishArtifactId
            version android.defaultConfig.versionName

            pom {
                name = publishArtifactId
                description = libraryDescription
                withXml {
                    def dependenciesNode = asNode().appendNode('dependencies')
                    configurations.implementation.allDependencies.each {
                        if (it.name != 'unspecified') {
                            def dependencyNode = dependenciesNode.appendNode('dependency')
                            dependencyNode.appendNode('groupId', it.group)
                            dependencyNode.appendNode('artifactId', it.name)
                            dependencyNode.appendNode('version', it.version)
                        }
                    }
                }
            }
        }
    }
}

def _user = System.getenv("BINTRAY_USER")
def _key =  System.getenv("BINTRAY_API_KEY")

if(project.rootProject.file('local.properties').exists() && (_user == null || _user.isEmpty())){
    Properties properties = new Properties()
    properties.load(project.rootProject.file('local.properties').newDataInputStream())
    _user = properties.getProperty("bintray.user")
    _key = properties.getProperty("bintray.apikey");
}

bintray {
    user = _user
    key = _key
    override = true
    publications = ['library']
    configurations = ['archives']
    pkg {
        repo = bitrayRepo
        name = bintrayPackage
        desc = libraryDescription
        websiteUrl = siteUrl
        vcsUrl = gitUrl
        licenses = allLicenses
        publish = true
        publicDownloadNumbers = true
        version {
            name = android.defaultConfig.versionName
            released = new Date()
            vcsTag = android.defaultConfig.versionName
        }
    }
}

当我运行 gradle bintrayUpload 时,我会在输出中看到以下内容。

> Task :app:bintrayUpload
Uploading to https://api.bintray.com/content/chathurabuddi/android/datetime-picker-wheel/0.0.1/datetime-picker-wheel/app/unspecified/app-unspecified.aar...
Uploaded to 'https://api.bintray.com/content/chathurabuddi/android/datetime-picker-wheel/0.0.1/datetime-picker-wheel/app/unspecified/app-unspecified.aar'.
Uploading to https://api.bintray.com/content/chathurabuddi/android/datetime-picker-wheel/0.0.1/lk/chathurabuddi/datetime-picker-wheel/0.0.1/datetime-picker-wheel-0.0.1.aar...
Uploaded to 'https://api.bintray.com/content/chathurabuddi/android/datetime-picker-wheel/0.0.1/lk/chathurabuddi/datetime-picker-wheel/0.0.1/datetime-picker-wheel-0.0.1.aar'.
Uploading to https://api.bintray.com/content/chathurabuddi/android/datetime-picker-wheel/0.0.1/lk/chathurabuddi/datetime-picker-wheel/0.0.1/datetime-picker-wheel-0.0.1.pom...
Uploaded to 'https://api.bintray.com/content/chathurabuddi/android/datetime-picker-wheel/0.0.1/lk/chathurabuddi/datetime-picker-wheel/0.0.1/datetime-picker-wheel-0.0.1.pom'.

如何防止将额外的 Artifact 上传到 Bintray?

最佳答案

由于您声明了 publications,因此无需添加 configurations = ['archives'] 行。尝试从您的 publish.gradle 文件中删除它

关于java - 防止将额外的 "app-unspecified.aar"上传到 Bintray,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60135228/

相关文章:

c# - Java 和 C# 互操作性

java - 处理线程池中的优先级

java - 当键不存在时,Hashtable 返回 null 或抛出异常?

android - 缩放 Canvas 以在 Android 中调整 SVG 的大小

java - 在java中打印一个变量n次

android - 设置 JSON 输入值动态

javascript - Cordova javascript 无法在模拟器上运行

android - Dagger 2 : No implementation generated for component interface

android - 有没有办法修复 EditText 中的字母宽度?

android - 我如何让 Gradle for Android 从其他测试代码中找到一个库的测试代码?