账号申请
-
- bintray 申请账号。
- 2.新建一个名称为:maven 的maven库。
库
-
- 新建 Android Studio 项目,新建要上传的Module模块。
-
- 在根目录(项目所在)下的 build.gradle中添加库引用
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.novoda:bintray-release:0.7.0' // a.novoda引用
}
}
allprojects {
repositories {
google()
jcenter()
}
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet') //忽略javadoc错误
options{
encoding "UTF-8"
charSet 'UTF-8'
links "http://docs.oracle.com/javase/7/docs/api"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
- 3.module中build.gradle添加maven配置
apply plugin: 'com.novoda.bintray-release'
//添加
publish {
userOrg = 'jfson'//bintray.com用户名
groupId = 'com.jfson'//jcenter上的路径
artifactId = 'widget'//项目名称
publishVersion = '1.0.1'//版本号
desc = 'this is decoupling Decoupling tools'//描述,不重要
website = 'https://github.com/jfson/widgetcontrol'//网站,不重要;尽量模拟github上的地址,例如我这样的;当然你有地址最好了
}
// 上传脚本
//./gradlew clean build bintrayUpload -PbintrayUser=jfson -PbintrayKey=****** -PdryRun=false
自行替换自己的参数配置、PbintrayUser和PbintrayKey。
* 4.最后在Terminal 中执行上传脚本即可。
添加到maven 库
- 右下角有个 add jcenter 按钮。大概几个小时就可以了