2015-06-23 9 views
6

Mi dispiace se sono troppo stupido ma non riesco a farlo funzionare ... Ho un progetto di modulo Android in AS che voglio caricare su JCenter - utilizzando il plugin gradle bintray dal JFrog. Seguo this esercitazione al fine di creare il repository su bintray e ho finito con la seguente build.gradle per il modulo:Come caricare il modulo su JCenter usando il plugin gradle bintray?

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

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

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

    configurations = ['published', 'archives'] 

    dryRun = false 
    publish = true 

    pkg { 
     repo = 'maven' 
     name = 'custom-searchable' 

     desc = 'This repository contains a library that aims to provide a custom searchable interface for android applications' 

     websiteUrl = 'https://github.com/...' 
     issueTrackerUrl = 'https://github.com/.../issues' 
     vcsUrl = 'https://github.com/....git' 

     licenses = ['The Apache Software License, Version 2.0'] 
     labels = ['android', 'searchable', 'interface', 'layout'] 
     publicDownloadNumbers = true 

     version { 
      name = '1.0' 
      desc = 'Bintray integration test' 
      vcsTag = '1.0' 
     } 
    } 
} 

ext { 
    bintrayRepo = 'maven' 
    bintrayName = 'custom-searchable' 

    publishedGroupId = 'br.com.edsilfer' 
    libraryName = 'CustomSearchable' 
    artifact = 'custom-searchable' 

    libraryDescription = 'This repository contains a library that aims to provide a custom searchable interface for android applications' 

    siteUrl = 'https://github.com/...' 
    gitUrl = 'https://github.com/....git' 

    libraryVersion = '1.0' 

    developerId = '...' 
    developerName = '...' 
    developerEmail = '...' 

    licenseName = 'The Apache Software License, Version 2.0' 
    licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt' 
    allLicenses = ["Apache-2.0"] 
} 


android { 
    compileSdkVersion 22 
    buildToolsVersion "22.0.1" 

    defaultConfig { 
     minSdkVersion 22 
     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:design:22.2.0' 
    compile 'com.android.support:recyclerview-v7:21.0.3' 
} 

E questo per il progetto:

// 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.3' 
     classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2' 
     classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' 
     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
    } 
} 

Dopo aver eseguito il compito gradle bintrayUpload (termina con successo) la mia repository in bintray sembra che:

first hierarchy E quando si apre la cartella specificata troverete questo:

enter image description here

Quindi domande!

  1. Perché la versione viene caricata come non specificata?
  2. Non riesco a compilare il mio progetto con l'id del gruppo dato: artefatto: versione, quando provo a crearlo su AS, dice che non riesce a risolvere il percorso del manufatto.

Qualsiasi aiuto sarà apprezzato!

+0

Hai dimenticato di aggiungere l'attributo versione nella build.gradle? – neferpitou

risposta

2

Si sta utilizzando la configurazione standard fornita dal plugin gradle, che non specifica la versione della libreria.

sto usando la pubblicazione invece:

... 
apply plugin: 'com.jfrog.bintray' 
apply plugin: 'maven-publish' 

... 

bintray { 
    ... 
    publications = ['Publication'] 
    pkg { 
     ... 
    } 
} 

publishing { 
    publications { 
     Publication(MavenPublication) { 
      artifact jar 
      groupId 'com.lib' 
      artifactId 'help-er' 
      version '0.1' 
     } 
    } 
} 

Se si desidera utilizzare le configurazioni verificare questa domanda: Publish on bintray using the gradle-bintray-plugin

Problemi correlati