1. 加载从远程仓库的架包
说明:在工程文件的 build.gradle
两个架包
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
2. bintray 的【用户名】和【私钥】
说明:
注册远程仓库 地址
3. 复制文件
//========================jcenter 仓库============================
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
def siteUrl =
'https://github.com/hongyelinggu/Scan-Create-QR-zxing.git' //
项目的主页 这个是说明,可随便填
def gitUrl =
'https://github.com/hongyelinggu/Scan-Create-QR-zxing.git' //
Git 仓库的 url 这个是说明,可随便填
group = "com.chaoqianhong.Scan-Create-QR-zxing" // 这里是 groupId ,
必须填写 一般填你唯一的包名
def libName = "Scan-Create-QR-zxing"
// 版本号,下次更新是只需要更改版本号即可
version = "1.0.0"
install {
repositories.mavenInstaller {
// This generates POM.xml with proper parameters
pom {
project {
packaging 'aar'
// Add your description here
name = libName //发布到 JCenter 上的项目名字,必须填写
url siteUrl
// Set your license
licenses {
license {
name 'The CommonUtil Software License, Version
1.0.0'
url
'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id 'chaoqianhong'
name 'Scan-Create-QR-zxing'
email '[email protected]' //填写开发者的
一些基本信息
}
}
scm {
connection gitUrl
developerConnection gitUrl
url siteUrl
}
}
}
}
}
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
//生成 DOC
task javadoc(type: Javadoc) {
options {
encoding "UTF-8"
charSet 'UTF-8'
author true
version true
links "http://docs.oracle.com/javase/7/docs/api"
}
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 sourcesJar
}
Properties properties = new Properties()
properties.load(project.file('../local.properties').newDataInputS
tream())
bintray {
user = properties.getProperty("bintray.user") //读取
local.properties 文件里面的 bintray.user
key = properties.getProperty("bintray.apikey") //读取
local.properties 文件里面的 bintray.apikey
configurations = ['archives']
pkg {
repo = "HongYeOfMave"
name = "Scan-Create-QR-zxing" //发布到 JCenter 上的项目名字,
必须填写,对应 com.squareup.okhttp3:okhttp:3.4.1 中的 okhttp
websiteUrl = siteUrl
vcsUrl = gitUrl
licenses = ["Apache-2.0"]
publish = true
}
}
4. 运行
- 生成 maven 库所需要的 POM 文件:
graedlew install - 上传你的 Library 库到 jcenter 的 maven 库:
graedlew bintrayUpload