将Android库上传到Bintray - 忽略userOrg参数

时间:2016-10-06 20:56:14

标签: maven gradle bintray jcenter

我正在尝试使用此指南将Android库上传到Bintray: https://inthecheesefactory.com/blog/how-to-upload-library-to-jcenter-maven-central-as-dependency/en

一切正常,直到我尝试运行bintrayUpload,当我收到以下错误时:

任务执行失败':MAS:bintrayUpload'。

  

无法创建包'user / maven / my-repo':HTTP / 1.1 404 Not Found [消息:未找到Repo'maven']

我认为问题在于该资源库是Bintray上的组织所有。但它正在用户之下寻找它。 即。 user / maven / my-repo应该是organization / maven / my-repo。

我的local.properties看起来像这样:

...    
bintray.userOrg=organisation
bintray.user=user
bintray.apikey=key
bintray.gpg.password=password
...

我的库模块的build.gradle如下所示:

/*
 * Copyright (c) 2016 CA. All rights reserved.
 *
 * This software may be modified and distributed under the terms
 * of the MIT license.  See the LICENSE file for details.
 *
 */

//noinspection GradleCompatible
// In order to build messaging using gradle 2 environment variables must be exportedd
// 1. prefix - this is the aar prefix, for example 'android'
// 2. versionName - this is the v.r.m formatted version name as used in the AndroidManifest.xml.
// For example, 1.1.0

plugins {
    id "com.jfrog.bintray" version "1.7"
    id "com.github.dcendents.android-maven" version "1.5"
}

apply plugin: 'com.android.library'
apply plugin: 'maven-publish'



ext {
    bintrayRepo = 'maven'
    bintrayName = 'mobile-app-services'

    publishedGroupId = 'com.ca'
    libraryName = 'MobileAppServices'
    artifact = 'mobile-app-services'

    libraryDescription = 'The Android Mobile SDK gives developers simple and secure access to the services of CA Mobile API Gateway and CA Mobile App Services. '

    siteUrl = 'https://github.com/CAAPIM/Android-MAS-SDK'
    gitUrl = 'https://github.com/CAAPIM/Android-MAS-SDK.git'

    libraryVersion = '3.2.00'

    developerId = 'devId'
    developerName = 'Full Name'
    developerEmail = 'user@email.com'

    licenseName = 'The MIT License (MIT)'
    licenseUrl = 'license.com'
    allLicenses = ["MIT"]
}

println '------> Executing mas library build.gradle'
repositories {
    mavenCentral()
    flatDir {
        dirs 'libs'
    }
}
android {
    compileSdkVersion 24
    buildToolsVersion '24.0.2'
    defaultConfig {
        minSdkVersion 19
        targetSdkVersion 24
        versionCode 12
        versionName "1.2"
    }

    lintOptions {
        abortOnError false
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

task javadoc(type: Javadoc) {
    source = android.sourceSets.main.java.srcDirs
    println "Source: $source"
    classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
    println "Classpath: $source"
    options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
    destinationDir = file("../docs/mas_javadoc/")
    failOnError false

    include '**/*MAS*.java'
    include '**/Device.java'
    include '**/ScimUser.java'

    exclude '**/MASTransformable.java'
    exclude '**/MASResultReceiver.java'
    exclude '**/MASWebServiceClient.java'
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:24.2.1'
    compile project(':MAG')
}

apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'

1 个答案:

答案 0 :(得分:6)

将上下文上载到组织拥有的存储库时,您必须使用以下路径遵守Bintray REST API约定: OrganizationName / RepoName 而不是 UserName / RepoName

我不知道你在上面写的路径中使用'maven'字是什么。

对于上面的情况,以下Bintray REST API链接可能会有所帮助:

在上面的情况中:subject 是指组织名称(而不是用户名)。在任何情况下,存储库都在用户之下,:subject 将被引用到用户名。

有关详细信息,请参阅完整的Bintray REST API documentation

上传文件的另一种方法是使用Bintray UI,这可以更加明显地了解您的存储库,包,版本和工件的结构。