2015-06-23 20 views
6

Tôi xin lỗi nếu tôi quá ngu ngốc nhưng tôi chỉ không thể làm cho nó làm việc ... Tôi có một dự án Mô-đun Android trong AS mà tôi muốn tải lên JCenter - sử dụng plugin bintray gradle từ JFrog. Tôi làm theo hướng dẫn this để tạo ra các kho lưu trữ trên bintray và tôi đã kết thúc với build.gradle sau cho các mô-đun:Làm thế nào để tải lên module để JCenter sử dụng plugin bintray gradle?

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

Và một điều này cho dự án:

// 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() 
    } 
} 

Sau khi chạy nhiệm vụ gradle bintrayUpload (kết thúc thành công) kho lưu trữ của tôi trong bintray trông giống như sau:

first hierarchy Và khi bạn mở thư mục không xác định, bạn sẽ tìm thấy:

enter image description here

Vì vậy, câu hỏi!

  1. Tại sao phiên bản đang được tải lên như không xác định?
  2. tôi không thể biên dịch dự án của tôi với id nhóm đưa ra: tạo tác: phiên bản, khi cố gắng để xây dựng nó trên AS nó nói rằng nó không giải quyết được đường dẫn đến tạo tác.

Mọi trợ giúp sẽ được đánh giá cao!

+0

cậu quên thêm phiên bản thuộc tính trong build.gradle của bạn? – neferpitou

Trả lời

2

Bạn đang sử dụng cấu hình tiêu chuẩn được cung cấp bởi các plugin gradle, mà không chỉ định phiên bản của thư viện.

Tôi đang sử dụng các ấn phẩm thay vì:

... 
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' 
     } 
    } 
} 

Nếu bạn muốn sử dụng cấu hình kiểm tra câu hỏi này: Publish on bintray using the gradle-bintray-plugin

Các vấn đề liên quan