Skip to content

Commit

Permalink
Fixing nexus publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
jdaugherty committed Dec 12, 2024
1 parent 90daa80 commit e722be9
Showing 1 changed file with 29 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,30 @@ The credentials and connection url must be specified as a project property or an
if (nexusPublish) {
rootProjectPluginManager.apply(NexusPublishPlugin)
projectPluginManager.apply(SigningPlugin)

project.rootProject.tasks.withType(InitializeNexusStagingRepository).configureEach { InitializeNexusStagingRepository task ->
task.shouldRunAfter = project.tasks.withType(Sign)
}

project.tasks.withType(Sign) {
onlyIf { isRelease }
}

project.rootProject.nexusPublishing {
repositories {
sonatype {
if (nexusPublishUrl) {
nexusUrl = project.uri(nexusPublishUrl)
}
if (nexusPublishSnapshotUrl) {
snapshotRepositoryUrl = project.uri(nexusPublishSnapshotUrl)
}
username = nexusPublishUsername
password = nexusPublishPassword
stagingProfileId = nexusPublishStagingProfileId
}
}
}
}

project.afterEvaluate {
Expand Down Expand Up @@ -272,36 +296,12 @@ The credentials and connection url must be specified as a project property or an
}
}
}
}

if (nexusPublish) {
extensionContainer.configure(SigningExtension, {
it.required = isRelease
it.sign project.publishing.publications.maven
})

project.rootProject.tasks.withType(InitializeNexusStagingRepository).configureEach { InitializeNexusStagingRepository task ->
task.shouldRunAfter = project.tasks.withType(Sign)
}

project.tasks.withType(Sign) {
onlyIf { isRelease }
}

project.rootProject.nexusPublishing {
repositories {
sonatype {
if (nexusPublishUrl) {
nexusUrl = project.uri(nexusPublishUrl)
}
if (nexusPublishSnapshotUrl) {
snapshotRepositoryUrl = project.uri(nexusPublishSnapshotUrl)
}
username = nexusPublishUsername
password = nexusPublishPassword
stagingProfileId = nexusPublishStagingProfileId
}
}
if(nexusPublish && isRelease) {
extensionContainer.configure(SigningExtension, {
it.required = isRelease
it.sign project.publishing.publications.maven
})
}
}

Expand Down

0 comments on commit e722be9

Please sign in to comment.