其他分享
首页 > 其他分享> > 如何将android库发布到Jfrog bintray?

如何将android库发布到Jfrog 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'.

的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
}

enter image description here

请仔细阅读我的脚本,并建议我一些解决方案.

解决方法:

在发布到Bintray之前,您必须拥有稳定的代码构建.
Bintray的层次结构如下:
用户 – >回购 – >包 – >版本 – >神器
表示Repo应该高于该层次结构的包.

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

pkg {
    repo = 'maven'
    name = 'helloaar.example.com.mylittlelibrary'
}

层次结构是错误的.

使用maven时,您应检查是否符合maven约定,否则Maven Build无法成功. Explanation for Maven Repositories on Bintray.

您遇到的错误:

HTTP/1.1 404 Not Found [message:Repo 'maven' was not found] 

意味着您在Bintray上没有存储库会调用maven.所有软件包版本和文件都应该在您创建的Bintray存储库下.

有关更多详细信息或支持问题,您可以使用适用于所有Bintray用户的Bintray support团队,并可以帮助您解决与任何JFrog平台服务相关的任何问题,例如Bintray,Artifactory,Mission control& X射线.

标签:android,maven,bintray
来源: https://codeday.me/bug/20190702/1352888.html