gradlew bintrayUpload命令不会将文件上传到bintray

时间:2016-09-21 12:30:04

标签: android maven gradle android-gradle bintray

我正在按照本教程https://antoniocappiello.com/2015/11/11/publish-your-library-to-jcenter-in-3-steps/发布我的第一个lib,并且我设法解决了除最后一个步骤之外的每个步骤遇到的问题。

执行./gradlew install后,然后运行./gradlew bintrayUpload

它构建成功但不上传我的文件。我有一个选项,我可以开始手动上传bintray中的文件,但那就是./gradlew bintrayUpload的目的。

或许,我的gradle设置是错误的。

这是我的顶级build.gradle

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

    buildscript {
        repositories {
            jcenter()
            maven {
                url  "http://dl.bintray.com/myUsername/myLibraryName"
            }
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:1.3.0'
            classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2'
            classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'

            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }

    allprojects {
        repositories {
            jcenter()
        }
    }

我的模块build.gradle

apply plugin: 'com.android.library'


android {
    compileSdkVersion 23
    buildToolsVersion "23.0.0"

    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    repositories {
        mavenCentral()
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

apply from: 'install.gradle'
apply from: 'bintray.gradle'

我的Install.gradle文件

apply plugin: 'com.github.dcendents.android-maven'

group = 'com.libraryname.v1' // CREATE A GROUP ID FOR YOUR LIBRARY

install {
    repositories.mavenInstaller {
        pom {
            project {
                packaging 'aar'
                groupId 'com.libraryname.v1' // CREATE A GROUP ID FOR YOUR LIBRARY
                artifactId 'ArtifactId' // THE NAME OF YOUR MODULE

                name 'myLibraryName' // YOUR LIBRARY NAME
                description 'my library description.' // YOUR LIBRARY DESCRIPTION
                url 'https://github.com/username/myLibraryName' // YOUR SITE

                licenses {
                    license {
                        name 'The Apache Software License, Version 2.0'
                        url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
                    }
                }
                developers {
                    developer {
                        id 'MyID' //YOUR ID
                        name 'MyName' //YOUR NAME
                        email 'myemail@gmail.com' //YOUR EMAIL
                    }
                }
                scm {
                    connection 'https://github.com/username/myLibraryName.git' // YOUR GIT REPO
                    developerConnection 'https://github.com/username/myLibraryName.git' // YOUR GIT REPO
                    url 'https://github.com/username/myLibraryName' // YOUR SITE

                }
            }
        }
    }
}

我的bintray.gradle

apply plugin: 'com.jfrog.bintray'

version = '0.0.1' //YOUR LIBRARY VERSION

task sourcesJar(type: Jar) {
    from android.sourceSets.main.java.srcDirs
    classifier = 'sources'
}

task javadoc(type: Javadoc) {
    source = android.sourceSets.main.java.srcDirs
    classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}

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

// Bintray


bintray {

    Properties properties = new Properties()
    properties.load( new FileInputStream("local.properties"))

    user = properties.getProperty("bintray.user")
    key = properties.getProperty("bintray.apikey")
    pkg {
        repo = 'libraryName'
        name = 'com.libraryName.v1' //YOUR PACKAGE NAME
        desc = 'my library description.' // YOUR LIBRARY DESCRIPTION
        websiteUrl = 'https://github.com/username/libraryName' // YOUR SITE
        vcsUrl = 'https://github.com/username/libraryName.git' // YOUR GIT REPO
        licenses = ["Apache-2.0"] // A LIST OF YOUR LICENCES
        publish = true
        publicDownloadNumbers = true
    }
}

1 个答案:

答案 0 :(得分:4)

bintray关闭缺少一行configurations = ['archives']