11import java.time.LocalDateTime
22
3- apply plugin : ' java'
4- apply plugin : ' maven-publish'
5- apply plugin : ' signing'
6- apply plugin : " io.github.gradle-nexus.publish-plugin"
7-
8- buildscript {
9- repositories {
10- maven {
11- url " https://plugins.gradle.org/m2/"
12- }
13- }
14- dependencies {
15- classpath " io.github.gradle-nexus:publish-plugin:1.1.0"
16- classpath " com.dipien:semantic-version-gradle-plugin:1.4.1"
17- }
3+ plugins {
4+ id ' java'
5+ id ' maven-publish'
6+ id ' signing'
7+ id ' com.gradleup.nmcp' version ' 0.0.8'
188}
199
20-
21- sourceCompatibility = 1.8
22- targetCompatibility = 1.8
23-
2410group ' com.github.sidhant92'
2511version = " 2.0.0"
2612
27- apply plugin : " com.dipien.semantic-version"
13+ java {
14+ sourceCompatibility = JavaVersion . VERSION_21
15+ targetCompatibility = JavaVersion . VERSION_21
16+ withJavadocJar()
17+ withSourcesJar()
18+ }
2819
2920repositories {
3021 mavenCentral()
@@ -35,9 +26,9 @@ dependencies {
3526 implementation ' org.antlr:antlr4-runtime:4.13.2'
3627 implementation ' io.vavr:vavr:0.10.4'
3728 implementation ' com.github.ben-manes.caffeine:caffeine:2.9.3'
38- implementation ' org.projectlombok:lombok:1.18.26 '
29+ implementation ' org.projectlombok:lombok:1.18.34 '
3930
40- annotationProcessor ' org.projectlombok:lombok:1.18.26 '
31+ annotationProcessor ' org.projectlombok:lombok:1.18.34 '
4132 testAnnotationProcessor ' org.openjdk.jmh:jmh-generator-annprocess:1.36'
4233
4334 testImplementation ' org.openjdk.jmh:jmh-core:1.35'
@@ -55,70 +46,74 @@ test {
5546 }
5647 useJUnitPlatform()
5748 reports {
58- junitXml. enabled = true
59- html. enabled = false
49+ junitXml. required = true
50+ html. required = false
6051 }
6152}
6253
63- java {
64- withJavadocJar()
65- withSourcesJar()
66- }
67-
68- artifacts {
69- archives javadocJar, sourcesJar
70- }
71-
72- /* signing {
73- sign configurations.archives
74- }*/
75-
76- signing {
77- def signingKey = findProperty(" signingKey" )
78- def signingPassword = findProperty(" signingPassword" )
79- useInMemoryPgpKeys(signingKey, signingPassword)
80- sign publishing. publications
81- }
82-
8354publishing {
8455 publications {
85- mavenJava(MavenPublication ) {
86- from(components. java)
56+ maven(MavenPublication ) {
57+ from components. java
58+
8759 pom {
8860 name = ' bool-parser'
8961 description = ' Java parser for boolean expressions'
9062 url = ' https://github.com/sidhant92/bool-parser-java'
63+
9164 licenses {
9265 license {
9366 name = ' The Apache License, Version 2.0'
94- url = ' http ://www.apache.org/licenses/LICENSE-2.0.txt'
67+ url = ' https ://www.apache.org/licenses/LICENSE-2.0.txt'
9568 }
9669 }
70+
9771 developers {
9872 developer {
9973 id = ' sidhant92'
10074 name = ' Sidhant Aggarwal'
75+ url = ' https://github.com/sidhant92'
10176 }
10277 }
78+
10379 scm {
80+ connection = ' scm:git:git://github.com/sidhant92/bool-parser-java.git'
81+ developerConnection
= ' scm:git:ssh://[email protected] /sidhant92/bool-parser-java.git' 10482 url = ' https://github.com/sidhant92/bool-parser-java'
105- connection = ' scm:git://github.com/sidhant92/bool-parser-java.git'
106- developerConnection = ' scm:git://github.com/sidhant92/bool-parser-java.git'
10783 }
10884 }
10985 }
11086 }
87+
88+ // Remove the old repository configuration - NMCP plugin handles this
89+ }
90+
91+ // Configure signing - only required for Maven Central, not for local publishing
92+ signing {
93+ def signingKey = System . getenv(" signingInMemoryKey" ) ?: findProperty(" signingInMemoryKey" )
94+ def signingPassword = System . getenv(" signingInMemoryKeyPassword" ) ?: findProperty(" signingInMemoryKeyPassword" )
95+
96+ // Only enable signing if keys are provided
97+ required { signingKey != null && signingPassword != null }
98+
99+ if (signingKey && signingPassword) {
100+ useInMemoryPgpKeys(signingKey as String , signingPassword as String )
101+ sign publishing. publications
102+ }
111103}
112104
113- nexusPublishing {
114- repositories {
115- sonatype()
105+ // Configure New Maven Central Portal publishing
106+ nmcp {
107+ publishAllPublications {
108+ username = System . getenv(" MAVEN_USERNAME" ) ?: findProperty(" mavenCentralUsername" )
109+ password = System . getenv(" MAVEN_PASSWORD" ) ?: findProperty(" mavenCentralPassword" )
110+ publicationType = " AUTOMATIC"
116111 }
117112}
118113
119- ext. genOutputDir = file(" $b uildDir /generated-resources" )
114+ ext. genOutputDir = file(" ${ layout.buildDirectory.get() } /generated-resources" )
120115
121- task generateVersionTxt ( ) {
116+ tasks . register( ' generateVersionTxt ' ) {
122117 ext. outputFile = file(" $genOutputDir /version.txt" )
123118 outputs. file(outputFile)
124119 doLast {
0 commit comments