2

我正在尝试将我的库上传到JCenter Repository。我遵循了本教程:

https://www.virag.si/2015/01/publishing-gradle-android-library-to-jcenter/

运行gradlew bintrayUpload命令后,我的build.gradle库。

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

// This is the library version used when deploying the artifact
version = "1.0.0"

android {
compileSdkVersion 22
buildToolsVersion "22.0.1"

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

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

def siteUrl = 'https://github.com/vipulasri/Layout-to-Image'      
def gitUrl = 'https://github.com/vipulasri/Layout-to-Image.git'   
group = "com.github.vipulasri"                    

install {
repositories.mavenInstaller {
    // This generates POM.xml with proper parameters
    pom {
        project {
            packaging 'aar'

            // Add your description here
            name 'Layout to Image'
            description = 'The project aims to convert your Android   Layout Xml to Image'
            url siteUrl

            // Set your license
            licenses {
                license {
                    name 'The Apache Software License, Version 2.0'
                    url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
                }
            }
            developers {
                developer {
                    id 'vipulasri'
                    name 'Vipul Asri'
                    email 'vipulasri.2007@gmail.com'
                }
            }
            scm {
                connection gitUrl
                developerConnection gitUrl
                url siteUrl

            }
        }
    }
}
}


dependencies {
}

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
}

task findConventions << {
println project.getConvention()
}




Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())


bintray {
user = properties.getProperty("bintray.user")
key = properties.getProperty("bintray.apikey")


configurations = ['archives']

pkg {
    repo = "maven"
    // it is the name that appears in bintray when logged
    name = "layouttoimage"
    websiteUrl = siteUrl
    vcsUrl = gitUrl
    licenses = ['Apache-2.0']
    publish = true

}
}

我收到以下错误:

Publications(s) specified but no publications exist in project :library.                 
:app:bintrayUpload FAILED         

FAILURE: Build failed with an exception.

* What went wrong:
Some problems were found with the configuration of task ':app:bintrayUpload'.
> No value has been specified for property 'packageName'.
> No value has been specified for property 'repoName'.
> No value has been specified for property 'apiKey'.
> No value has been specified for property 'user'.

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

BUILD FAILED 
4

2 回答 2

4

我只是遇到这个问题,我的解决方案是,编辑项目顶部 build.gradle,启用classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2"和禁用//plugins { // id "com.jfrog.bintray" version "1.2" //}

它对我有用,希望对你有帮助。

于 2015-05-10T13:12:17.623 回答
0

您的顶级 Build.gradle 应包含此代码以成功构建 gradle :

// Top-level build file where you can add configuration options common to all sub-projects/modules.


buildscript {
repositories {
    jcenter()
}

dependencies {
    classpath 'com.android.tools.build:gradle:1.2.2'
    classpath 'com.github.dcendents:android-maven-plugin:1.2'
    classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.1"

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}

allprojects {

repositories {
    jcenter()
}
}
于 2015-05-13T08:10:02.400 回答