forked from PAXSTORE/paxstore-3rd-app-android-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublishAndroidLib.gradle
101 lines (84 loc) · 3.57 KB
/
publishAndroidLib.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
94
95
96
97
98
99
100
101
apply plugin: 'maven'
apply plugin: 'signing'
ext["signing.keyId"] = ''
ext["signing.password"] = ''
ext["signing.secretKeyRingFile"] = ''
ext["ossrhUsername"] = ''
ext["ossrhPassword"] = ''
File secretPropsFile = project.rootProject.file('local.properties')
if (secretPropsFile.exists()) {
println "Found secret props file, loading props"
Properties p = new Properties()
p.load(new FileInputStream(secretPropsFile))
p.each { name, value ->
ext[name] = value
}
} else {
println "No props file, loading env vars"
}
def PUBLISH_GROUP_ID = 'com.whatspos.sdk' //这里可以不是直接申请时候的groupId只要开头是就可以
def PUBLISH_ARTIFACT_ID = "paxstore-3rd-app-android-sdk"
def PUBLISH_VERSION = android.defaultConfig.versionName //这个是直接获取的库gradle里配置好的版本号,不用到处修改版本号,只需要维护一份就可以。
// 当你发布的是一个纯java的依赖,那么就需要把下面的方法打开因为纯java的依赖,maven那边要求提供完整的javadoc,
// 但是aar不需要提供,也无法提供,因为下面的task javadocJar命令无法被识别
//task javadocJar(type: Jar) {
// classifier = 'javadoc'
// from javadoc
//}
//
//task sourcesJar(type: Jar) {
// classifier = 'sources'
// from sourceSets.main.allSource
//}
//
//artifacts {
// archives javadocJar, sourcesJar
//}
//签名
signing {
required { gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
snapshotRepository(url: "https://s01.oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
pom.groupId = PUBLISH_GROUP_ID
pom.artifactId = PUBLISH_ARTIFACT_ID
pom.version = PUBLISH_VERSION
pom.project {
name 'paxstore-3rd-app-android-sdk'
packaging 'aar' //我这里发布的是安卓的包,所有写的aar
// optionally artifactId can be defined here
//修改项目描述和url
description 'PAXSTORE 3rd App Android SDK provides simple and easy-to-use service interfaces for third party developers to develop android apps on PAXSTORE.'
url 'https://github.com/PAXSTORE/paxstore-3rd-app-android-sdk'
scm {
//修改成你的Git地址:
connection = 'scm:git:github.com/PAXSTORE/paxstore-3rd-app-android-sdk.git'
developerConnection = 'scm:git:ssh://github.com/PAXSTORE/paxstore-3rd-app-android-sdk.git'
//分支地址:
url = 'https://github.com/PAXSTORE/paxstore-3rd-app-android-sdk/tree/master'
}
licenses {
license {
name 'The Apache License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers { // 改成你自己的信息
developer {
name 'Derek'
email '[email protected]'
}
}
}
}
}
}