From c330c8b5f76efec345f88d5e8a0396574fd43aef Mon Sep 17 00:00:00 2001 From: Gerd Aschemann Date: Mon, 27 Jan 2025 23:21:07 +0100 Subject: [PATCH] #314 Copy HSC only artifacts to staging repo Builds and integration tests copy many files to the mavenBuildRepo. But JReleaser only wants to find the files for upload to Maven Central. Therefore we copy those file to a `mavenStagingRepo`. Somehow this seems to also have solved occasional flaws wrt signing the artifacts which is necessary for Maven Central. --- build.gradle | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/build.gradle b/build.gradle index ca8fce04..1439f065 100644 --- a/build.gradle +++ b/build.gradle @@ -74,33 +74,35 @@ ext.urls = [ developerConnection: 'scm:git:ssh://github.com/aim42/htmlSanityCheck.git' ] -// tag::mavenBuildRepo[] File baseBuildDir = file("${project.rootDir}/${Project.DEFAULT_BUILD_DIR_NAME}") File mavenBuildRepo = new File(baseBuildDir, "maven-repo") -// end::mavenBuildRepo[] tasks.register("cleanMavenBuildRepo", Delete) { - description "Clean intermediate Maven Repository '${mavenBuildRepo}'" + description "Clean intermediate local Maven Repository '${mavenBuildRepo}'" delete mavenBuildRepo } -tasks.register('signAll') { - doLast { - logger.quiet("Signed all artifacts for upload with JReleaser") - } +File mavenStagingRepo = new File(baseBuildDir, "staging-repo") + +tasks.register("cleanMavenStagingRepo", Delete) { + description "Clean intermediate staging Maven Repository '${mavenStagingRepo}'" + delete mavenBuildRepo +} + +tasks.register("copyOrgAim42ToStagingRepo", Copy) { + description = "Copy 'org/aim42' from '${mavenBuildRepo}; to '${mavenStagingRepo}'" + from new File(mavenBuildRepo, "org/aim42") + into new File(mavenStagingRepo, "org/aim42") } -signAll.dependsOn( - ':htmlSanityCheck-core:signMavenJavaPublication', - ':htmlSanityCheck-gradle-plugin:signHtmlSanityCheckPluginMarkerMavenPublication', - ':htmlSanityCheck-gradle-plugin:signPluginMavenPublication' -) -jreleaserDeploy.dependsOn( - 'signAll', +copyOrgAim42ToStagingRepo.dependsOn( ':htmlSanityCheck-core:publishAllPublicationsToMyLocalRepositoryForFullIntegrationTestsRepository', - ':htmlSanityCheck-gradle-plugin:publishAllPublicationsToMyLocalRepositoryForFullIntegrationTestsRepository' + ':htmlSanityCheck-gradle-plugin:publishAllPublicationsToMyLocalRepositoryForFullIntegrationTestsRepository', + ':htmlSanityCheck-maven-plugin:publishAllPublicationsToMyLocalRepositoryForFullIntegrationTestsRepository' ) +jreleaserDeploy.dependsOn(copyOrgAim42ToStagingRepo) + jreleaser { project { license = 'Apache-2.0' @@ -140,7 +142,7 @@ jreleaser { active = 'ALWAYS' sign = false url = 'https://central.sonatype.com/api/v1/publisher' - stagingRepository(mavenBuildRepo.toString()) + stagingRepository(mavenStagingRepo.toString()) } } }