gradle: add support for custom repo to publish to

And introduce useSonatype setting to skip the sonatype repos if
desired.
This commit is contained in:
Florian Schmaus 2020-04-07 16:56:54 +02:00
parent ea944a8dc6
commit 398cba330b
1 changed files with 24 additions and 3 deletions

View File

@ -134,6 +134,12 @@ allprojects {
junitVersion = '5.6.0'
powerMockVersion = '2.0.2'
commonsIoVersion = '2.6'
if (project.hasProperty("useSonatype")) {
useSonatype = project.getProperty("useSonatype").toBoolean()
} else {
// Default to true
useSonatype = true
}
}
group = 'org.igniterealtime.smack'
sourceCompatibility = JavaVersion.VERSION_1_8
@ -457,15 +463,30 @@ subprojects {
}
}
repositories {
maven {
url isSnapshot ? sonatypeSnapshotUrl : sonatypeStagingUrl
if (sonatypeCredentialsAvailable) {
if (sonatypeCredentialsAvailable && useSonatype) {
maven {
url isSnapshot ? sonatypeSnapshotUrl : sonatypeStagingUrl
credentials {
username = sonatypeUsername
password = sonatypePassword
}
}
}
// Use
// gradle publish -P customRepoUrl=https://www.igniterealtime.org/archiva/repository/maven -P customRepoUsername=bamboo -P customRepoPassword=hidden -P useSonatype=false
// to deploy to this repo.
if (project.hasProperty("customRepoUrl")) {
maven {
name 'customRepo'
url customRepoUrl
if (project.hasProperty("customRepoUsername")) {
credentials {
username customRepoUsername
password customRepoPassword
}
}
}
}
}
}
rootProject.distributionZip {