1.注册https://bintray.com
2.创建仓库
3.在这里
获取APIKEY
4.去AS中配置
4.1先在项目的根配置中
<pre>
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
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
}
</pre>
4.2在库的配置中
<pre>
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
version = "0.1.1" // 修改为你的版本号
.....//这里是原来的配置
def siteUrl = 'https://github.com/bertsir/ImageLoader' // 修改为你的项目的主页
def gitUrl = 'https://github.com/bertsir/ImageLoader.git' // 修改为你的Git仓库的url
group = "cn.bertsir.imageloaderlibrary" // 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 'Glide plug Library' //项目描述
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 'bertsir' //填写的一些基本信息
name 'bertsir'
email 'bertsir37@gmail.com'
}
}
scm {
connection gitUrl
developerConnection gitUrl
url siteUrl
}
}
}
}
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
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 //生成javadoc容易出错,与其不要
archives sourcesJar
}
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
bintray {
user = properties.getProperty("bintray.user")
key = properties.getProperty("bintray.apikey")
configurations = ['archives']
pkg {
repo = "ImageLoader"
name = "ImageLoader" //发布到JCenter上的项目名字
websiteUrl = siteUrl
vcsUrl = gitUrl
licenses = ["Apache-2.0"]
publish = true
}
</pre>
5.在local.properties中加
bintray.user=jcenter的用户名
bintray.apikey=jcenter的apikey
最后
等待吧,successful之后在jcenter的后台找到上传的库,在右面找到
等待审核通过后就可以一行代码使用你的库了