@@ -176,12 +176,49 @@ task createCentralBundle(type: Zip) {
176176 def localRepo = repositories. mavenLocal(). url
177177 def groupPath = project. group. toString(). replace(' .' , ' /' )
178178 def artifactPath = " ${ groupPath} /${ base.archivesName.get()} /${ project.version} "
179+ def sourceDir = " ${ localRepo} /${ artifactPath} "
179180
180- from(" ${ localRepo} /${ artifactPath} " ) {
181+ doFirst {
182+ // Generate checksums for all files
183+ fileTree(sourceDir). each { file ->
184+ if (file. isFile() && ! file. name. endsWith(' .md5' ) && ! file. name. endsWith(' .sha1' )) {
185+ // Generate MD5
186+ ant. checksum(file : file, algorithm : ' MD5' , fileext : ' .md5' )
187+ // Generate SHA1
188+ ant. checksum(file : file, algorithm : ' SHA1' , fileext : ' .sha1' )
189+ }
190+ }
191+ }
192+
193+ from(sourceDir) {
181194 include ' **/*'
195+ // Maintain the proper Maven repository structure in the zip
196+ into(" ${ groupPath} /${ base.archivesName.get()} /${ project.version} " )
182197 }
183198
184199 destinationDirectory = file(" ${ buildDir} /central" )
200+
201+ doLast {
202+ // Validate bundle contents
203+ def requiredFiles = [
204+ " ${ base.archivesName.get()} -${ project.version} .jar" ,
205+ " ${ base.archivesName.get()} -${ project.version} .pom" ,
206+ " ${ base.archivesName.get()} -${ project.version} -sources.jar" ,
207+ " ${ base.archivesName.get()} -${ project.version} -javadoc.jar"
208+ ]
209+
210+ def bundleFile = archiveFile. get(). asFile
211+ logger. lifecycle(" Created bundle: ${ bundleFile} " )
212+ logger. lifecycle(" Bundle size: ${ bundleFile.length()} bytes" )
213+
214+ // Check if signing was performed
215+ def hasSignatures = fileTree(sourceDir). any { it. name. endsWith(' .asc' ) }
216+ if (hasSignatures) {
217+ logger. lifecycle(" ✅ Bundle includes PGP signatures" )
218+ } else {
219+ logger. warn(" ⚠️ Bundle does not include PGP signatures (signing keys not provided)" )
220+ }
221+ }
185222}
186223
187224// Task to upload bundle to Central Portal
@@ -200,7 +237,7 @@ task uploadToCentralPortal(type: Exec) {
200237}
201238
202239signing {
203- required { gradle. taskGraph. hasTask(" uploadToCentralPortal" ) }
240+ required { gradle. taskGraph. hasTask(" uploadToCentralPortal" ) && findProperty( " signingKey " ) }
204241 def signingKey = findProperty(" signingKey" )
205242 def signingPassword = findProperty(" signingPassword" )
206243 if (signingKey && signingPassword) {
0 commit comments