【问题标题】:Can't publish android library to bintray无法将android库发布到bintray
【发布时间】:2017-08-19 03:40:06
【问题描述】:

试图将库发布到 bintray,我真的快疯了。
我遵循了官方指南以及几个教程,但我的库从未上传到 bintray。
库本身运行良好(至少在我的测试中)。

这是库模块的 build.gradle 文件。
我运行了命令

./gradlew install

然后

./gradlw bintrayUpload

它们都以“BUILD SUCCESSFUL”结尾,但在 bintray 网站中什么也没有出现。
我做错了什么?

apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
//apply plugin: 'java'


def siteUrl = 'https://github.com/stefanosiano/PowerfulImageView'      // Homepage URL of the library
def gitUrl = 'https://github.com/stefanosiano/PowerfulImageView.git'   // Git repository URL
def libDescription = 'Custom Android ImageView with several added features.'
def gitTag = '0.1.1'
def pkgName = 'powerful-image-view'
def libGroupId = "com.stefanosiano"                                          // Maven Group ID for the artifact
def libArtifactId = "powerful-image-view"                                          // Maven Group ID for the artifact
def libName = "Powerful Image View"                                          // Maven Group ID for the artifact
def libVersion = "0.1.1"// This is the library version used when deploying the artifact

group = libGroupId //bintray org/group name
version = libVersion //version

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"

    defaultConfig {
        minSdkVersion 12
        targetSdkVersion 25
        versionCode 1
        versionName libVersion
        consumerProguardFiles 'piv-proguard-rules.txt'

    }
}
dependencies {
    compile 'com.android.support:appcompat-v7:25.3.0'
}






install {
    repositories.mavenInstaller {
        // This generates POM.xml with proper parameters
        pom {
            project {
                packaging 'aar'
                groupId libGroupId
                artifactId libArtifactId

                // Add your description here
                name libName
                description libDescription
                url siteUrl

                // Set your license
                licenses {
                    license {
                        name 'MIT License'
                        url 'https://opensource.org/licenses/MIT'
                    }
                }
                developers {
                    developer {
                        id 'stefanosiano'
                        name 'Stefano Siano'
                        email 'stefano.siano91@gmail.com'
                    }
                }
                scm {
                    connection gitUrl
                    developerConnection gitUrl
                    url siteUrl

                }
            }
        }
    }
}



version = libVersion

if (project.hasProperty("android")) { // Android libraries
    task sourcesJar(type: Jar) {
        classifier = 'sources'
        from android.sourceSets.main.java.srcDirs
    }

    task javadoc(type: Javadoc) {
        source = android.sourceSets.main.java.srcDirs
        classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
    }
} else { // Java libraries
    task sourcesJar(type: Jar, dependsOn: classes) {
        classifier = 'sources'
        from sourceSets.main.allSource
    }
}

task javadocJar(type: Jar, dependsOn: javadoc) {
    classifier = 'javadoc'
    from javadoc.destinationDir
}

artifacts {
    archives javadocJar
    archives sourcesJar
}




// https://github.com/bintray/gradle-bintray-plugin
bintray {
    user = System.getenv('BINTRAY_USER')
    key = System.getenv('BINTRAY_KEY')

    configurations = ['archives']

    // Package info for BinTray
    pkg {
        repo = 'maven-repo'
        // it is the name that appears in bintray when logged
        name = pkgName
        desc = libDescription
        websiteUrl = siteUrl
        vcsUrl = gitUrl
        licenses = ['MIT']
        publish = true
        publicDownloadNumbers = true
        version {
            name = libVersion
            desc = libDescription
            released = new Date()
            vcsTag = gitTag
        }
    }
}

这是我的项目 build.gradle 文件:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.0'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
// Plugin used to upload authenticated files to BinTray through Gradle
plugins {
    id "com.jfrog.bintray" version "1.7.3"
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

感谢您的帮助,因为我从某天开始尝试失败:(

【问题讨论】:

    标签: android android-library bintray


    【解决方案1】:

    好的,对我来说问题是我的 Fedora 丢失了我的环境变量。
    再次导出后,一切正常。

    我的第一个图书馆上线了!耶!

    【讨论】:

      猜你喜欢
      • 2017-01-16
      • 1970-01-01
      • 2015-01-25
      • 2018-08-26
      • 2016-03-23
      • 2019-03-01
      • 2017-05-28
      • 2018-04-10
      • 1970-01-01
      相关资源
      最近更新 更多