From e722be9d41774b5ae284be102c6df56ad56cbc0d Mon Sep 17 00:00:00 2001 From: James Daugherty Date: Thu, 12 Dec 2024 12:55:24 -0500 Subject: [PATCH] Fixing nexus publishing --- .../GrailsPublishGradlePlugin.groovy | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/src/main/groovy/org/grails/gradle/plugin/publishing/GrailsPublishGradlePlugin.groovy b/src/main/groovy/org/grails/gradle/plugin/publishing/GrailsPublishGradlePlugin.groovy index 91211f45..5eeb9d54 100644 --- a/src/main/groovy/org/grails/gradle/plugin/publishing/GrailsPublishGradlePlugin.groovy +++ b/src/main/groovy/org/grails/gradle/plugin/publishing/GrailsPublishGradlePlugin.groovy @@ -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 { @@ -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 + }) } }