java - 使用 bintray 上传创建空 .jar

标签 java android gradle android-maven-plugin bintray

我是将模块上传到 bintray 任务的新手,但我成功注册了 bintray 帐户,我阅读了 gradle bintray-plugin ,我在 build.gradle 中进行了更改, package & (lib).jar 创建成功,但 (lib).jar 是空的。 所以请帮助我,我的项目出了什么问题。 在配置 build.gradle 后,我按照以下步骤上传 lib yo bintray 帐户

  1. 在终端上运行 gradlew install 即可成功构建。
  2. 在终端上运行 gradlew bintray 即可成功构建。

项目根build.gradle:

buildscript {
    repositories {
        jcenter()
    }
    apply plugin: 'java'
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
    }
}

plugins {
    id "com.jfrog.bintray"
    version "1.7"
}


allprojects {
    repositories {
        jcenter()
    }
    apply plugin: 'com.github.dcendents.android-maven'
}

group = 'com.app.kickdrill'
version = '0.0.1'

应用build.gradle

apply plugin: 'com.android.library'

task clean(type: Delete) {
    delete rootProject.buildDir
}

android {
    publishNonDefault true
    compileSdkVersion 23
    buildToolsVersion '25.0.2'
    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 1
        versionName "0.0.1"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-     android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'LICENSE.txt'
    }

}

dependencies {
    androidTestCompile('com.android.support.test.espresso:espresso-   core:2.2.2', {
        exclude group: 'com.android.support',
        module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support:recyclerview-v7:23.4.0'
    compile 'com.android.volley:volley:1.0.0'
    compile 'com.google.code.gson:gson:2.3.1'
    compile 'com.squareup.retrofit2:retrofit:2.0.2'
    compile 'com.squareup.retrofit2:converter-gson:2.0.2'
    compile 'com.squareup.okhttp3:okhttp:3.3.1'
    compile 'com.android.support:design:23.4.0'
    testCompile 'junit:junit:4.12'
}

install {
    repositories.mavenInstaller {
        pom.project {
            name 'KickDrill'
            description 'its for an android developer'
            url 'https://github.com/kickdrilldev/androidkickdrill'
            inceptionYear '2017'
            packaging 'aar'
            groupId 'com.app.kickdrill'
            artifactId 'androidKickdrill'
            version '0.0.1'

            licenses {
                license {
                    name 'The Apache Software License, Version 2.0'
                    url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
                    distribution 'repo'
                }
            }
            scm {
                connection 'https://github.com/kickdrilldev/androidkickdrill.git'
                url 'https://github.com/kickdrilldev/androidkickdrill'

            }
            developers {
                developer {
                    name 'Vyankatesh Jadhav'
                }
            }
        }
    }
}



bintray {
    user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
    key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
    configurations = ['archives']
    pkg {
        repo = 'kickdrill'
        name = 'androidkickdrill'
        userOrg = 'androiddevs'
        licenses = ['Apache-2.0']
        vcsUrl = 'https://github.com/kickdrilldev/androidkickdrill'
        version {
            name = 'androidKickdrill'
            desc = 'its for an android developer'
            vcsTag = '0.0.1'
            attributes = ['gradle-plugin': 'com.use.less:com.use.less.gradle:gradle-useless-plugin']
        }
    }
}

最佳答案

com.android.library 插件生成 Android 存档 (AAR),而不是 Java 存档 (JAR)。

此外,如果您想将存档上传到 bintray,请使用 bintrayUpload 任务:

./gradlew bintrayUpload

此外,在您的配置中,如果您希望在上传到 Bintray 时自动发布版本,则可以使用 publish = true :

bintray {
    publish = true //If version should be auto published after an upload
}

您可以找到更多信息here

关于java - 使用 bintray 上传创建空 .jar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42479983/

相关文章:

java - 富 Ajax 应用程序的 CSRF token 生成

Android 触控对焦

安卓工作室 : Gradle failed to resolve Dependencies

gradle - log4j2错误:正在运行通过Gradle生成的jar-log4j:WARN找不到记录器的附加程序

gradle - 提供者 pactVerify 没有获取 JSON Pact 文件

node.js - 如何从gradle任务中打开allure?

java - 在 JVM 中清理 DNS 服务器

java - 使用 Apache PDFBox 将实心圆添加到 PDF 页面

java - 我无法让我的 java 程序打印结果

android - Google Play 显示 - 您的设备与此版本不兼容,无法下载该应用程序