@@ -6,14 +6,19 @@ plugins {
6
6
id ' com.github.hierynomus.license' version ' 0.16.1'
7
7
id ' com.github.spotbugs' version " 6.0.14"
8
8
id ' maven-publish'
9
+ id ' signing'
10
+ id ' io.github.gradle-nexus.publish-plugin' version ' 2.0.0'
9
11
}
10
12
11
13
allprojects {
12
14
apply plugin : ' idea'
13
15
apply plugin : ' jacoco'
14
16
15
17
repositories {
16
- jcenter()
18
+ mavenCentral()
19
+ maven {
20
+ url ' https://plugins.gradle.org/m2/'
21
+ }
17
22
}
18
23
19
24
jacoco {
@@ -24,9 +29,9 @@ allprojects {
24
29
allprojects {
25
30
group = ' com.optimizely.ab'
26
31
27
- def travis_defined_version = System . getenv(' GITHUB_TAG' )
28
- if (travis_defined_version != null ) {
29
- version = travis_defined_version
32
+ def github_tagged_version = System . getenv(' GITHUB_TAG' )
33
+ if (github_tagged_version != null ) {
34
+ version = github_tagged_version
30
35
}
31
36
32
37
ext. isReleaseVersion = ! version. endsWith(" SNAPSHOT" )
@@ -47,13 +52,6 @@ configure(publishedProjects) {
47
52
sourceCompatibility = 1.8
48
53
targetCompatibility = 1.8
49
54
50
- repositories {
51
- jcenter()
52
- maven {
53
- url ' https://plugins.gradle.org/m2/'
54
- }
55
- }
56
-
57
55
task sourcesJar(type : Jar , dependsOn : classes) {
58
56
archiveClassifier. set(' sources' )
59
57
from sourceSets. main. allSource
@@ -120,7 +118,6 @@ configure(publishedProjects) {
120
118
}
121
119
}
122
120
123
-
124
121
def docTitle = " Optimizely Java SDK"
125
122
if (name. equals(' core-httpclient-impl' )) {
126
123
docTitle = " Optimizely Java SDK: Httpclient"
@@ -137,17 +134,6 @@ configure(publishedProjects) {
137
134
artifact javadocJar
138
135
}
139
136
}
140
- repositories {
141
- maven {
142
- def releaseUrl = " https://oss.sonatype.org/service/local/staging/deploy/maven2"
143
- def snapshotUrl = " https://oss.sonatype.org/content/repositories/snapshots"
144
- url = isReleaseVersion ? releaseUrl : snapshotUrl
145
- credentials {
146
- username System . getenv(' MAVEN_CENTRAL_USERNAME' )
147
- password System . getenv(' MAVEN_CENTRAL_PASSWORD' )
148
- }
149
- }
150
- }
151
137
}
152
138
153
139
signing {
@@ -183,7 +169,18 @@ configure(publishedProjects) {
183
169
}
184
170
185
171
task ship () {
186
- dependsOn(' :core-api:ship' , ' :core-httpclient-impl:ship' )
172
+ dependsOn(' :core-httpclient-impl:ship' , ' :core-api:ship' , ' publishToSonatype' , ' closeSonatypeStagingRepository' )
173
+ }
174
+
175
+ nexusPublishing {
176
+ repositories {
177
+ sonatype {
178
+ nexusUrl. set(uri(' https://ossrh-staging-api.central.sonatype.com/service/local/' ))
179
+ snapshotRepositoryUrl. set(uri(' https://central.sonatype.com/repository/maven-snapshots/' ))
180
+ username = System . getenv(' MAVEN_CENTRAL_USERNAME' )
181
+ password = System . getenv(' MAVEN_CENTRAL_PASSWORD' )
182
+ }
183
+ }
187
184
}
188
185
189
186
task jacocoMerge (type : JacocoMerge ) {
@@ -224,7 +221,6 @@ tasks.coveralls {
224
221
}
225
222
226
223
// standard POM format required by MavenCentral
227
-
228
224
def customizePom (pom , title ) {
229
225
pom. withXml {
230
226
asNode(). children(). last() + {
0 commit comments