1
1
apply plugin : ' com.android.library'
2
2
apply plugin : ' kotlin-android'
3
- apply plugin : ' maven-publish'
4
- apply plugin : ' signing'
3
+ apply plugin : ' com.vanniktech.maven.publish'
5
4
apply from : " ${ project.rootDir} /gradle-scripts/jacoco_root.gradle"
6
5
apply from : " ${ project.rootDir} /gradle-scripts/checkstyle.gradle"
7
6
apply from : " ${ project.rootDir} /gradle-scripts/detekt.gradle"
8
7
9
8
ext {
10
- Repo = ' Maven'
11
9
publishedGroupId = ' com.clevertap.android'
12
10
13
11
siteUrl = ' https://github.com/CleverTap/clevertap-android-sdk'
18
16
developerEmail
= ' [email protected] '
19
17
}
20
18
21
- ext[" signing.keyId" ] = ' '
22
- ext[" signing.password" ] = ' '
23
- ext[" signing.secretKeyRingFile" ] = ' '
24
- ext[" ossrhUsername" ] = ' '
25
- ext[" ossrhPassword" ] = ' '
26
- ext[" sonatypeStagingProfileId" ] = ' '
27
-
28
19
version = libraryVersion
29
20
group = publishedGroupId
30
21
@@ -100,82 +91,41 @@ if (project.rootProject.file('local.properties').exists()) {
100
91
properties. each { name , value ->
101
92
ext[name] = value
102
93
}
103
- }else {
104
- ext[" signing.keyId" ] = System . getenv(' SIGNING_KEY_ID' )
105
- ext[" signing.password" ] = System . getenv(' SIGNING_PASSWORD' )
106
- ext[" signing.secretKeyRingFile" ] = System . getenv(' SIGNING_SECRET_KEY_RING_FILE' )
107
- ext[" ossrhUsername" ] = System . getenv(' OSSRH_USERNAME' )
108
- ext[" ossrhPassword" ] = System . getenv(' OSSRH_PASSWORD' )
109
- ext[" sonatypeStagingProfileId" ] = System . getenv(' SONATYPE_STAGING_PROFILE_ID' )
110
- }
111
-
112
- task sourcesJar (type : Jar ) {
113
- archiveBaseName. set(" $artifact " )
114
- from android. sourceSets. main. java. srcDirs
115
- archiveClassifier. set(' sources' )
116
94
}
117
95
118
- artifacts {
119
- archives sourcesJar
120
- }
121
96
122
97
afterEvaluate {
123
- publishing {
124
- publications {
125
- // Creates a Maven publication called "release".
126
- release(MavenPublication ) {
127
- // Applies the component for the release build variant.
128
- from components. release
129
-
130
- // You can then customize attributes of the publication as shown below.
131
- groupId publishedGroupId
132
- artifactId artifact
133
- version version
134
-
135
- pom {
136
- name = artifact
137
- description = libraryDescription
138
- url = siteUrl
139
- packaging = " aar"
140
- licenses {
141
- license {
142
- name = licenseName
143
- url = licenseUrl
144
- }
145
- }
146
- developers {
147
- developer {
148
- id = developerId
149
- name = developerName
150
- email = developerEmail
151
- }
152
- // Add all other devs here...
153
- }
154
- // Version control info - if you're using GitHub, follow the format as seen here
155
- scm {
156
- connection = ' scm:git:github.com/CleverTap/clevertap-android-sdk.git'
157
- developerConnection = ' scm:git:ssh:github.com/CleverTap/clevertap-android-sdk.git'
158
- url = ' https://github.com/CleverTap/clevertap-android-sdk/tree/master'
159
- }
98
+ mavenPublishing {
99
+ publishToMavenCentral(" CENTRAL_PORTAL" )
100
+ signAllPublications()
101
+
102
+ coordinates(publishedGroupId, artifact, libraryVersion)
103
+
104
+ pom {
105
+ name. set(" $artifact " )
106
+ description. set(" $libraryDescription " )
107
+ url. set(siteUrl)
108
+
109
+ licenses {
110
+ license {
111
+ name. set(licenseName)
112
+ url. set(licenseUrl)
160
113
}
161
114
}
162
- }
163
- // The repository to publish to, Sonatype/MavenCentral
164
- repositories {
165
- maven {
166
- // This is an arbitrary name, you may also use "mavencentral" or
167
- // any other name that's descriptive for you
168
- name = Repo
169
- url = " https://oss.sonatype.org/service/local/staging/deploy/maven2/"
170
- credentials {
171
- username ossrhUsername
172
- password ossrhPassword
115
+
116
+ developers {
117
+ developer {
118
+ id. set(developerId)
119
+ name. set(developerName)
120
+ email. set(developerEmail)
173
121
}
174
122
}
123
+
124
+ scm {
125
+ connection. set(" scm:git:$gitUrl " )
126
+ developerConnection. set(" scm:git:$gitUrl " )
127
+ url. set(siteUrl)
128
+ }
175
129
}
176
130
}
177
131
}
178
-
179
- signing {
180
- sign publishing. publications
181
- }
0 commit comments