其他分享
首页 > 其他分享> > android-gradlew bintrayUpload命令不会将文件上传到Bintray

android-gradlew bintrayUpload命令不会将文件上传到Bintray

作者:互联网

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

完成./gradlew安装后,然后当我运行./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
    }
}

解决方法:

bintray闭包缺少行配置= [‘archives’].

标签:android-gradle,maven,gradle,bintray,android
来源: https://codeday.me/bug/20191026/1938268.html