Skip to content

Commit 52ab09b

Browse files
committed
Publish release builds to Maven Central automatically
Adds the nexus-staging-plugin which allows to automatically close and release the staging repository on OSSRH.
1 parent c41b6f0 commit 52ab09b

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ script:
2020

2121
after_success:
2222
- ./travis/publish.sh
23+
- ./gradlew closeAndReleaseRepository
2324

2425
deploy:
2526
provider: releases

build.gradle

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import java.util.regex.Matcher
1919
plugins {
2020
id 'org.ajoberstar.grgit' version '2.0.1'
2121
id 'org.sonarqube' version '2.5'
22+
id 'io.codearte.nexus-staging' version '0.11.0'
2223
}
2324

2425
ext.scmInfo = getScmInfo()
@@ -182,6 +183,24 @@ sonarqube {
182183
}
183184
}
184185

186+
nexusStaging {
187+
if (project.hasProperty('stagingServerUrl')) {
188+
serverUrl = stagingServerUrl
189+
}
190+
if (project.hasProperty('releaseRepositoryUser')) {
191+
username = releaseRepositoryUser
192+
password = releaseRepositoryPassword
193+
}
194+
}
195+
196+
tasks.closeRepository.onlyIf {
197+
rootProject.scmInfo.isRelease()
198+
}
199+
200+
tasks.releaseRepository.onlyIf {
201+
rootProject.scmInfo.isRelease()
202+
}
203+
185204
class ScmInfo {
186205
def version
187206
def tag

0 commit comments

Comments
 (0)