Skip to content

Commit

Permalink
Merge pull request #370 from jdaugherty/7.0.x
Browse files Browse the repository at this point in the history
Fixing nexus publishing
  • Loading branch information
jdaugherty authored Dec 12, 2024
2 parents aa56597 + e722be9 commit 9e5ddd2
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 9e5ddd2

Please sign in to comment.