在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):danielemaddaluno/gradle-jcenter-publish开源软件地址(OpenSource Url):https://github.com/danielemaddaluno/gradle-jcenter-publish开源编程语言(OpenSource Language):开源软件介绍(OpenSource Introduction):Publish an aar file to jCenter with Gradle:Firstly I thank JBaruch, who patiently drove me all along the process of publishing (see the stackoverflow question). Now I'm going to list how to publish an Android libray to jCenter and then syncronize it with Maven Central:
gpg --gen-key # generates the key pair
gpg --list-keys # get your PubKeyId (this value is used in the line below)
gpg --keyserver hkp://pool.sks-keyservers.net --send-keys PubKeyId # publish your Key
gpg -a --export [email protected] > public_key_sender.asc
gpg -a --export-secret-key [email protected] > private_key_sender.asc
classpath 'com.github.dcendents:android-maven-plugin:1.2'
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.1" So that your buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
classpath 'com.github.dcendents:android-maven-plugin:1.2'
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.1"
}
}
allprojects {
repositories {
jcenter()
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion "21.0.0"
defaultConfig {
//applicationId "com.madx.updatechecker.lib"
minSdkVersion 8
targetSdkVersion 21
versionCode 1
versionName "1.0.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'org.jsoup:jsoup:+'
} To this one: 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 21
buildToolsVersion "21.1.2"
defaultConfig {
//applicationId "com.madx.updatechecker.lib"
minSdkVersion 8
targetSdkVersion 21
versionCode 1
versionName "1.0.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'org.jsoup:jsoup:1.8.1'
}
def siteUrl = 'https://github.com/danielemaddaluno/Android-Update-Checker' // Homepage URL of the library
def gitUrl = 'https://github.com/danielemaddaluno/Android-Update-Checker.git' // Git repository URL
group = "com.github.danielemaddaluno.androidupdatechecker" // Maven Group ID for the artifact
install {
repositories.mavenInstaller {
// This generates POM.xml with proper parameters
pom {
project {
packaging 'aar'
// Add your description here
name 'Android Update Checker'
description = 'The project aims to provide a reusable instrument to check asynchronously if exists any newer released update of your Android app on the Store.'
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 'danielemaddaluno'
name 'Daniele Maddaluno'
email '[email protected]'
}
}
scm {
connection gitUrl
developerConnection gitUrl
url siteUrl
}
}
}
}
}
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
}
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
// https://github.com/bintray/gradle-bintray-plugin
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 = "androidupdatechecker"
websiteUrl = siteUrl
vcsUrl = gitUrl
licenses = ["Apache-2.0"]
publish = true
version {
gpg {
sign = true //Determines whether to GPG sign the files. The default is false
passphrase = properties.getProperty("bintray.gpg.password") //Optional. The passphrase for GPG signing'
}
// mavenCentralSync {
// sync = true //Optional (true by default). Determines whether to sync the version to Maven Central.
// user = properties.getProperty("bintray.oss.user") //OSS user token
// password = properties.getProperty("bintray.oss.password") //OSS user password
// close = '1' //Optional property. By default the staging repository is closed and artifacts are released to Maven Central. You can optionally turn this behaviour off (by puting 0 as value) and release the version manually.
// }
}
}
}
bintray.user=<your bintray username>
bintray.apikey=<your bintray api key>
bintray.gpg.password=<your gpg signing password>
bintray.oss.user=<your sonatype username>
bintray.oss.password=<your sonatype password>
sudo gedit .bashrc Add to the bottom of file
gradle bintrayUpload
dependencies {
repositories {
mavenCentral()
// maven {
// url 'http://dl.bintray.com/danielemaddaluno/maven/'
// }
}
compile 'com.github.danielemaddaluno.androidupdatechecker:library:+'
} If you use the default of Android Studio, jcenter() you could simply import like this (for me it doesn't work without the exactly version, i.e. with the plus gives me an error) ``` gradle dependencies { compile 'com.github.danielemaddaluno.androidupdatechecker:library:1.0.3' }
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论