上传 android 模块到 bintray 并链接到 jcenter
Uploading android module to bintray and linking to jcenter
您好,我正在关注 Gradle Bintray 插件 https://github.com/bintray/gradle-bintray-plugin#readme 教程的 github 站点,但是我不太了解出版物部分。谁能帮我这个?我目前正在研究 bintray 1.7.3 版。
更新:
我能够在 bintray 中成功上传。但是我现在的问题是在其他项目中下载它。同步 gradle 时出现错误:
-找不到 android-dbpatcher.jar(sirqo:android-dbpatcher:0.0.1)。
-错误:在以下位置搜索:
http://sirqo.bintray.com/Android-DBPatcher/sirqo/android-dbpatcher/0.0.1/android-dbpatcher-0.0.1.jar
更新2:
作为参考,这是我的 gradle.build 在我的模块
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
minSdkVersion 9
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
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:25.0.1'
testCompile 'junit:junit:4.12'
compile 'com.android.volley:volley:1.0.0'
}
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
}
group = 'xxxx'
version = '0.0.1'
install {
repositories.mavenInstaller {
pom.project {
name 'android-dbpatcher'
description 'A library for updating SQLite database in android.'
url 'https://sirqo.bintray.com/Android-DBPatcher'
inceptionYear '2016'
packaging 'aar'
groupId 'xxxx'
artifactId 'android-dbpatcher'
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"
}
}
developers {
developer {
id 'xxxx'
name 'xxxxx'
email 'xxxxxx@gmail.com'
}
}
}
}
}
Properties bintrayProperties = new Properties()
bintrayProperties.load(project.rootProject.file('bintray.properties').newDa taInputStream())
bintray {
user = bintrayProperties.getProperty('user')
key = bintrayProperties.get('key')
configurations = ['archives']
pkg {
repo = 'Android-DBPatcher'
name = 'android-dbpatcher'
userOrg = 'xxxx'
vcsUrl = 'https://github.com/sirqo/android-dbpatcher'
publish = true
version {
name = '0.0.1'
desc = 'Android SQLite Database Patcher'
released = new Date()
vcsTag = 'v0.0.1'
}
}
}
所以我想通了。作为参考,我将分享我的代码。
对于我的项目gradle.build
// 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:2.2.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7'
// 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.3"
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
对于我的模块 gradle.build
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
minSdkVersion 9
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
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:25.0.1'
testCompile 'junit:junit:4.12'
compile 'com.android.volley:volley:1.0.0'
}
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
}
group = 'xxxx' //bintray org/group name
version = '0.0.1' //version
install {
repositories.mavenInstaller {
pom.project {
name 'xxxxx' //package name
description 'A library for updating SQLite database in android.'
url 'xxxxx'
inceptionYear '2016'
packaging 'aar'
groupId 'xxxx' //group/org id
artifactId 'xxxx' //your android module name
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"
}
}
developers {
developer {
id 'xxxxx' //developer username
name 'xxxxxx' //developer name
email 'xxxxxx@gmail.com' //developer email
}
}
scm {
connection 'xxxxxx' // YOUR GIT REPO
developerConnection 'xxxxxx' // YOUR GIT REPO
url 'xxxxxxx' // YOUR SITE
}
}
}
}
Properties bintrayProperties = new Properties()
bintrayProperties.load(project.rootProject.file('bintray.properties').newDataInputStream())
bintray {
user = bintrayProperties.getProperty('user')
key = bintrayProperties.get('key')
configurations = ['archives']
pkg {
repo = 'xxxxxx' //Bintray repository
name = 'xxxxxx' //Bintray Package name
userOrg = 'xxxxx'
licenses = ['Apache-2.0']
vcsUrl = 'xxxxxxxx'
publish = true
version {
name = '0.0.1' //version
desc = 'xxxxxx' //Description
released = new Date()
vcsTag = 'v0.0.1'
}
}
}
在此之后,在您的 android 工作室中打开下面的 android 终端并输入此命令
./gradlew 安装
- 如果有一些错误,您可以在命令后附加--debug 并重新输入命令以跟踪错误
//如果没有其他失败发出此命令
./gradlew bintrayUpload
*同样,如果出现错误,您可以使用该命令并附加 --debug 来跟踪它。
完成所有这些后,您将收到一封电子邮件或其他内容,然后您可以继续在其他项目中下载您的库。编码愉快!
您好,我正在关注 Gradle Bintray 插件 https://github.com/bintray/gradle-bintray-plugin#readme 教程的 github 站点,但是我不太了解出版物部分。谁能帮我这个?我目前正在研究 bintray 1.7.3 版。
更新:
我能够在 bintray 中成功上传。但是我现在的问题是在其他项目中下载它。同步 gradle 时出现错误:
-找不到 android-dbpatcher.jar(sirqo:android-dbpatcher:0.0.1)。
-错误:在以下位置搜索:
http://sirqo.bintray.com/Android-DBPatcher/sirqo/android-dbpatcher/0.0.1/android-dbpatcher-0.0.1.jar
更新2: 作为参考,这是我的 gradle.build 在我的模块
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
minSdkVersion 9
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
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:25.0.1'
testCompile 'junit:junit:4.12'
compile 'com.android.volley:volley:1.0.0'
}
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
}
group = 'xxxx'
version = '0.0.1'
install {
repositories.mavenInstaller {
pom.project {
name 'android-dbpatcher'
description 'A library for updating SQLite database in android.'
url 'https://sirqo.bintray.com/Android-DBPatcher'
inceptionYear '2016'
packaging 'aar'
groupId 'xxxx'
artifactId 'android-dbpatcher'
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"
}
}
developers {
developer {
id 'xxxx'
name 'xxxxx'
email 'xxxxxx@gmail.com'
}
}
}
}
}
Properties bintrayProperties = new Properties()
bintrayProperties.load(project.rootProject.file('bintray.properties').newDa taInputStream())
bintray {
user = bintrayProperties.getProperty('user')
key = bintrayProperties.get('key')
configurations = ['archives']
pkg {
repo = 'Android-DBPatcher'
name = 'android-dbpatcher'
userOrg = 'xxxx'
vcsUrl = 'https://github.com/sirqo/android-dbpatcher'
publish = true
version {
name = '0.0.1'
desc = 'Android SQLite Database Patcher'
released = new Date()
vcsTag = 'v0.0.1'
}
}
}
所以我想通了。作为参考,我将分享我的代码。
对于我的项目gradle.build
// 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:2.2.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7'
// 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.3"
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
对于我的模块 gradle.build
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
minSdkVersion 9
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
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:25.0.1'
testCompile 'junit:junit:4.12'
compile 'com.android.volley:volley:1.0.0'
}
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
}
group = 'xxxx' //bintray org/group name
version = '0.0.1' //version
install {
repositories.mavenInstaller {
pom.project {
name 'xxxxx' //package name
description 'A library for updating SQLite database in android.'
url 'xxxxx'
inceptionYear '2016'
packaging 'aar'
groupId 'xxxx' //group/org id
artifactId 'xxxx' //your android module name
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"
}
}
developers {
developer {
id 'xxxxx' //developer username
name 'xxxxxx' //developer name
email 'xxxxxx@gmail.com' //developer email
}
}
scm {
connection 'xxxxxx' // YOUR GIT REPO
developerConnection 'xxxxxx' // YOUR GIT REPO
url 'xxxxxxx' // YOUR SITE
}
}
}
}
Properties bintrayProperties = new Properties()
bintrayProperties.load(project.rootProject.file('bintray.properties').newDataInputStream())
bintray {
user = bintrayProperties.getProperty('user')
key = bintrayProperties.get('key')
configurations = ['archives']
pkg {
repo = 'xxxxxx' //Bintray repository
name = 'xxxxxx' //Bintray Package name
userOrg = 'xxxxx'
licenses = ['Apache-2.0']
vcsUrl = 'xxxxxxxx'
publish = true
version {
name = '0.0.1' //version
desc = 'xxxxxx' //Description
released = new Date()
vcsTag = 'v0.0.1'
}
}
}
在此之后,在您的 android 工作室中打开下面的 android 终端并输入此命令
./gradlew 安装
- 如果有一些错误,您可以在命令后附加--debug 并重新输入命令以跟踪错误
//如果没有其他失败发出此命令 ./gradlew bintrayUpload *同样,如果出现错误,您可以使用该命令并附加 --debug 来跟踪它。
完成所有这些后,您将收到一封电子邮件或其他内容,然后您可以继续在其他项目中下载您的库。编码愉快!