-
Notifications
You must be signed in to change notification settings - Fork 29
Migration from gradle_nexus_staging plugin nexus_publish plugin duo
Marcin Zajączkowski edited this page Feb 21, 2021
·
9 revisions
This page was intended to help migrate from the gradle-nexus-staging-plugin + nexus-publish-plugin duo to publish-plugin.
plugins {
id "io.codearte.nexus-staging" version "0.22.0"
id "de.marcphilipp.nexus-publish" version "0.4.0"
}
↓
plugins {
id "io.github.gradle-nexus.publish-plugin" version "<version>"
}
nexusStaging {
packageGroup = "com.example.mycompany.myproject"
stagingProfileId = "yourStagingProfileId"
}
nexusPublishing {
repositories {
sonatype()
}
}
↓
nexusPublishing {
packageGroup = "com.example.mycompany.myproject" //defaults to 'project.group'
repositories {
sonatype { //custom repository name - 'sonatype' is pre-configured
//for Sonatype Nexus (OSSRH) which is used for The Central Repository
stagingProfileId = "yourStagingProfileId" //can reduce execution time by even 10 seconds
}
}
}
//majority of the properties is optional, you might just don't have them in your project
nexusStaging {
packageGroup = "com.example.mycompany.myproject"
stagingProfileId = "yourStagingProfileId"
//by default project properties 'nexusUsername' and 'nexusPassword' are used
username = project.findProperty("...")
password = project.findProperty("...")
numberOfRetries = 40
delayBetweenRetriesInMillis = 3000
}
nexusPublishing {
repositories {
sonatype {
//by default value from above 'nexusStaging' closure is used (alternative project properties 'sonatypeUsername' and 'sonatypePassword')
username = project.findProperty("...")
password = project.findProperty("...")
}
}
clientTimeout = Duration.ofSeconds(300)
connectTimeout = Duration.ofSeconds(60)
}
↓
nexusPublishing {
packageGroup = "com.example.mycompany.myproject" //defaults to 'project.group'
repositories {
sonatype { //or custom repository name
stagingProfileId = "yourStagingProfileId" //can reduce execution time by even 10 seconds
//defaults to project properties 'sonatypeUsername' and 'sonatypePassword', where 'sonatype' is name of configured repository
username = project.findProperty("...")
password = project.findProperty("...")
}
}
clientTimeout = Duration.ofSeconds(300)
connectTimeout = Duration.ofSeconds(60)
transitionCheckOptions {
maxRetries.set(40)
delayBetween.set(java.time.Duration.ofMillis(3000))
}
}
./gradlew publish closeAndReleaseRepository
↓
./gradlew publishToSonatype closeAndReleaseStagingRepository
(or closeAndReleaseSonatypeStagingRepository
if preferred for consistency)