如何将Android库发布到Jfrog Bintray?

dee*_*ode 5 android maven bintray

我正在从事Android库开发工作,我已经完成了库工作并生成了aar和jar文件,但是当我当时尝试发布为二进制文件时,我收到一条错误消息。

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':mylittlelibrary:bintrayUpload'.
> Could not create package 'abcd/maven/helloaar.example.com.mylittlelibrary': HTTP/1.1 404 Not Found [message:Repo 'maven' was not found]

* Try:
  Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 5.391 secs
Could not create package 'abcd/maven/helloaar.example.com.mylittlelibrary': HTTP/1.1 404 Not    Found [message:Repo 'maven' was not found]
2:41:59 AM: External task execution finished 'bintrayUpload'.
Run Code Online (Sandbox Code Playgroud)

build.gradle

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

repositories {
   mavenCentral()
}

android {
compileSdkVersion 24
buildToolsVersion "24.0.0"

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

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:24.0.0-beta1'
}

 group = 'helloaar.example.com.mylittlelibrary'
 version = '1.0.2'

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

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

 task generateJavaDocsJar(type: Jar) {
     from generateJavaDocs.destinationDir
     classifier 'javadoc'
 }
 generateJavaDocsJar.dependsOn generateJavaDocs

bintray {
    user = 'abcd'
    key = '1234567890fghgfhffjfgjfjfjrtyjtkjg'
    pkg {
       repo = 'maven'
       name = 'helloaar.example.com.mylittlelibrary'

    version {
        name = '1.0.2'
        desc = 'My test upload'
        released  = new Date()
        vcsTag = '1.0.2'
    }

    licenses = ['Apache-2.0']
    vcsUrl = ''
    websiteUrl = ''
}
configurations = ['archives']
}

artifacts {
   archives generateJavaDocsJar
   archives generateSourcesJar
}
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

请仔细阅读我的脚本,并向我提出一些解决方案。

Rot*_*tem 2

在发布到 Bintray 之前,您必须拥有稳定的代码版本。Bintray 上的层次结构如下: User --> Repo --> package --> version --> artifact 意味着 Repo 应该位于该层次结构的包之上。

gradle.build 中的以下行可能是错误的主要原因:

pkg {
    repo = 'maven'
    name = 'helloaar.example.com.mylittlelibrary'
}
Run Code Online (Sandbox Code Playgroud)

层次结构是错误的。

使用maven时应检查是否遵守maven约定,否则Maven构建无法成功。Bintray 上的 Maven 存储库的说明。

您遇到的错误:

HTTP/1.1 404 Not Found [message:Repo 'maven' was not found] 
Run Code Online (Sandbox Code Playgroud)

意味着你没有 Bintray 上的 Repository 调用 maven。所有软件包版本和文件都应位于您创建的 Bintray 存储库下。

如需更多详细信息或支持问题,您可以联系Bintray 支持团队,该团队面向所有 Bintray 用户,可以帮助您解决与任何 JFrog 平台服务(例如 Bintray、Artifactory、Mission control 和 Xray)相关的任何问题。