applyplugin:'com.github.dcendents.android-maven'
applyplugin:'com.jfrog.bintray'
//项目主页
def siteUrl ='https://github.com/czl0325/ZLDotProgressbar-android'
//项目的版本控制地址
def gitUrl ='https://github.com/czl0325/ZLDotProgressbar-android.git'
//发布到组织名称名字,必须填写
group ="com.github.czl0325"
//发布到JCenter上的项目名字,必须填写
def libName ="ZLDotProgressbar"
// 版本号,下次更新是只需要更改版本号即可
version ="0.0.1"
/** 上面配置后上传至jcenter后的编译路径是这样的:compile 'cn.bluemobi.dylan:sqlitelibrary:1.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))
options.encoding"UTF-8"
options.charSet'UTF-8'
options.authortrue
options.versiontrue
options.links"https://github.com/linglongxin24/FastDev/tree/master/mylibrary/docs/javadoc"
failOnErrorfalse
}
//文档打包成jar
task javadocJar(type: Jar,dependsOn: javadoc) {
classifier ='javadoc'
from javadoc.destinationDir
}
//拷贝javadoc文件
task copyDoc(type: Copy) {
from"${buildDir}/docs/"
into"docs"
}
//上传到jcenter所需要的源码文件
artifacts {
archivesjavadocJar
archivessourcesJar
}
// 配置maven库,生成POM.xml文件
install {
repositories.mavenInstaller {
// This generates POM.xml with proper parameters
pom {
project {
packaging'aar'
name'a dot progressbar framework'
url siteUrl
licenses {
license {
name'a dot progressbar framework'
url'https://github.com/czl0325/ZLDotProgressbar-android'
}
}
developers {
developer {
id'czl'
name'czl0325'
email'295183917@qq.com'
}
}
scm {
connection gitUrl
developerConnection gitUrl
url siteUrl
}
}
}
}
}
//上传到jcenter
Properties properties =new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
bintray {
user = properties.getProperty("bintray.user")//读取 local.properties 文件里面的bintray.user
key = properties.getProperty("bintray.apikey")//读取 local.properties 文件里面的bintray.apikey
configurations = ['archives']
pkg {
repo ="maven"
name ="ZLDotProgressbar" //发布到JCenter上的项目名字,必须填写
desc ='a dot progressbar framework' //项目描述
websiteUrl = siteUrl
vcsUrl = gitUrl
licenses = ["Apache-2.0"]
publish =true
}
}