-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbintray.gradle
93 lines (81 loc) · 2.89 KB
/
bintray.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// 应用发布相关插件
apply plugin: 'com.jfrog.bintray'
apply plugin: 'maven-publish'
// 项目主页
def siteUrl = 'https://github.com/wurensen/Greendao3GradlePlugin'
// 项目的git地址
def gitUrl = 'https://github.com/wurensen/Greendao3GradlePlugin.git'
// 项目描述
def description = 'A android plugin for generating greendao dao sources codes by sort.'
//发布到组织名称名字,必须填写
group = "com.lancewu"
// 版本号,下次更新只需要更改版本号即可
version = "1.0.0"
// 发布到JCenter上的项目名字,同时也是artifactId
def libName = "greendao-gradle-plugin"
def myArtifactId = libName
// 源代码打包任务
task sourcesJar(type: Jar) {
baseName libName
classifier 'sources'//分类器,区分其他jar包
from sourceSets.main.allSource
}
// 文档包任务
task docJar(type: Jar, dependsOn: [javadoc, groovydoc]) {
baseName libName
classifier 'doc'//分类器,区分其他jar包
from javadoc.destinationDir, groovydoc.destinationDir
}
javadoc {
options{
// 如果你的项目里面有中文注释的话,必须将格式设置为UTF-8,不然会出现乱码
encoding "UTF-8"
charSet 'UTF-8'
links "http://docs.oracle.com/javase/7/docs/api"
}
}
// 配置工程工件,也就是jar产出的配置
artifacts {
archives sourcesJar
archives docJar
}
// 上传到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
publications = ['PluginPublication']
pkg {
// 这里的repo值必须要和你创建Maven仓库的时候的名字一样
repo = "maven"
// 发布到JCenter上的项目名字
name = libName
// 项目描述
desc = description
websiteUrl = siteUrl
vcsUrl = gitUrl
licenses = ["Apache-2.0"]
publish = true
}
}
publishing {
publications {
PluginPublication(MavenPublication) {
from components.java
// 如果不指定,默认就是工程名
artifactId myArtifactId
artifact sourcesJar
artifact docJar
// pom文件配置
pom.withXml {
def root = asNode()
def licensesNode = root.appendNode('licenses').appendNode('license')
licensesNode.appendNode('name', 'Apache License, Version 2.0')
licensesNode.appendNode('url', 'https://www.apache.org/licenses/LICENSE-2.0.txt')
licensesNode.appendNode('distribution', 'repo')
licensesNode.appendNode('comments', 'A business-friendly OSS license')
}
}
}
}