如何使用 gradle bintray 插件将模块上传到 JCenter?
How to upload module to JCenter using gradle bintray plugin?
很抱歉,如果我太笨了,但我无法让它工作...我在 AS 中有一个 Android 模块项目,我想上传到 JCenter - 使用 gradle 来自 JFrog. I follow this 教程的 bintray 插件,以便在 bintray 上创建存储库,我最终得到了以下 build.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'
}
这一个用于项目:
// 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()
}
}
在 运行 任务 gradle bintrayUpload
之后(成功完成)我在 bintray 中的存储库如下所示:
当您打开未指定的文件夹时,您会发现:
所以问题!
- 为什么上传的版本不明确?
- 我无法使用给定的组 id:artifact:version 编译我的项目,当尝试在 AS 上构建它时,它说它无法解析工件的路径。
任何帮助将不胜感激!
您正在使用 gradle 插件提供的标准配置,没有指定库版本。
我正在使用该出版物:
...
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'
}
}
}
如果你想使用配置检查这个问题:
很抱歉,如果我太笨了,但我无法让它工作...我在 AS 中有一个 Android 模块项目,我想上传到 JCenter - 使用 gradle 来自 JFrog. I follow this 教程的 bintray 插件,以便在 bintray 上创建存储库,我最终得到了以下 build.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'
}
这一个用于项目:
// 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()
}
}
在 运行 任务 gradle bintrayUpload
之后(成功完成)我在 bintray 中的存储库如下所示:
所以问题!
- 为什么上传的版本不明确?
- 我无法使用给定的组 id:artifact:version 编译我的项目,当尝试在 AS 上构建它时,它说它无法解析工件的路径。
任何帮助将不胜感激!
您正在使用 gradle 插件提供的标准配置,没有指定库版本。
我正在使用该出版物:
...
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'
}
}
}
如果你想使用配置检查这个问题: