-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish.gradle
68 lines (65 loc) · 2.75 KB
/
publish.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
//发布依赖库到Maven仓库
apply plugin: 'maven-publish'
apply plugin: 'signing'
task generateSourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier 'sources'
}
//上传maven公开库需要签名
ext["signing.keyId"] = "141399E4" //GPG指纹后8位
ext["signing.password"] = "368396delie" //GPG密码
ext["signing.secretKeyRingFile"] = "/Users/zhaojianwei/.gnupg/signing/jianweizhao_0x141399E4_SECRET.gpg" //GPG私钥文件在本地的文件目录
// Finally publish the artifact
afterEvaluate {
publishing {
repositories {
maven {
name = 'sonatypeRepository' // 名字可随意,会显示在 task 中
if (version.endsWith("SNAPSHOT")) {
url "https://s01.oss.sonatype.org/content/repositories/snapshots/" //快照版本库
} else {
url "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" //正式版本库
}
credentials {
username "kingcool759"
password "368396delieZJW#"
}
}
}
publications {
release(MavenPublication) {
from components.release
artifact generateSourcesJar
groupId = "io.github.Kingcool759" //申请时填写的域名
artifactId = mavenArtifactId(project.name)
version = mavenVersion(project.name)
pom {
name = project.name// 推荐和 artifactId 相同
description = "noting to description"
url = "https://github.com/Kingcool759/KC_MVVMComponent" //项目主页地址,可用 GitHub
licenses {
license {
name = "The Apache License, Version 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
}
}
developers {
developer { //随意填开发者信息
id = "007"
name = "kingcool759"
email = "[email protected]"
}
}
scm {
connection = "scm:svn:http://github.com/Kingcool759/KC_MVVMComponent" //项目联系地址
developerConnection = "scm:svn:https://github.com/Kingcool759/KC_MVVMComponent" //项目仓库地址
url = "http://github.com/Kingcool759/KC_MVVMComponent" //项目主页地址
}
}
}
}
}
signing {
sign publishing.publications //签名
}
}