@@ -18,9 +18,10 @@ plugins {
1818 kotlin(" jvm" ) version " 2.0.21"
1919 kotlin(" kapt" ) version " 2.0.21"
2020 id(" com.github.johnrengelman.shadow" ) version " 8.1.1"
21- application
21+ id( " org.jreleaser " ) version " 1.14.0 "
2222 `maven- publish`
2323 signing
24+ application
2425}
2526
2627group = " dev.parsek"
@@ -154,45 +155,7 @@ tasks.named("jar").configure {
154155 enabled = defaultJarEnabled.toBoolean()
155156}
156157
157- publishing {
158- repositories {
159- maven {
160- name = " Parsek"
161- url = uri(" https://maven.pkg.github.com/ParsekDev/parsek" )
162- credentials {
163- username = project.findProperty(" gpr.user" ) as String? ? : System .getenv(" USERNAME_GITHUB" )
164- password = project.findProperty(" gpr.token" ) as String? ? : System .getenv(" TOKEN_GITHUB" )
165- }
166- }
167-
168- }
169-
170- publications {
171- create<MavenPublication >(" shadow" ) {
172- project.extensions.configure<ShadowExtension > {
173- artifactId = " core"
174- component(this @create)
175- }
176- }
177- }
178- }
179-
180- signing {
181- val signingKey = System .getenv(" GPG_PRIVATE_KEY" )?.let { String (Base64 .getDecoder().decode(it.replace(" \n " , " " ))) }
182- val signingPassphrase = System .getenv(" GPG_PASSPHRASE" )
183-
184- if (! signingKey.isNullOrEmpty() && ! signingPassphrase.isNullOrEmpty()) {
185- useInMemoryPgpKeys(signingKey, signingPassphrase)
186- sign(publishing.publications)
187- } else {
188- logger.warn(" Signing is not configured. Skipping signing tasks." )
189- }
190- }
191-
192158java {
193- withJavadocJar()
194- withSourcesJar()
195-
196159 // Use Java 21 for compilation
197160 toolchain {
198161 languageVersion.set(JavaLanguageVersion .of(21 ))
@@ -212,4 +175,116 @@ tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
212175tasks.withType<JavaCompile > {
213176 sourceCompatibility = " 1.8"
214177 targetCompatibility = " 1.8"
178+ }
179+
180+ // Publishing configuration
181+ publishing {
182+ publications {
183+ create<MavenPublication >(" maven" ) {
184+ groupId = " dev.parsek"
185+ artifactId = " core"
186+ version = project.version.toString()
187+
188+ from(components[" java" ])
189+
190+ // Include sources and javadoc
191+ artifact(tasks.named(" kotlinSourcesJar" ))
192+ artifact(tasks.named(" javadocJar" ))
193+
194+ pom {
195+ name.set(" Parsek" )
196+ description.set(" A lightweight, modular framework for building RESTful APIs with Kotlin and Vert.x" )
197+ url.set(" https://github.com/Statucorp/parsek-core" )
198+ inceptionYear.set(" 2024" )
199+
200+ licenses {
201+ license {
202+ name.set(" MIT License" )
203+ url.set(" https://opensource.org/licenses/MIT" )
204+ }
205+ }
206+
207+ developers {
208+ developer {
209+ id.set(" StatuCorp" )
210+ name.set(" Statu Corporation" )
211+ 212+ }
213+ }
214+
215+ scm {
216+ connection.set(" scm:git:git://github.com/Statucorp/parsek-core.git" )
217+ developerConnection.set(" scm:git:ssh://github.com/Statucorp/parsek-core.git" )
218+ url.set(" https://github.com/Statucorp/parsek-core" )
219+ }
220+ }
221+ }
222+ }
223+
224+ repositories {
225+ maven {
226+ url = layout.buildDirectory.dir(" staging-deploy" ).get().asFile.toURI()
227+ }
228+ }
229+ }
230+
231+ // Configure Kotlin sources jar
232+ tasks.register<Jar >(" kotlinSourcesJar" ) {
233+ archiveClassifier.set(" sources" )
234+ from(sourceSets[" main" ].allSource)
235+ }
236+
237+ // Configure Javadoc jar
238+ tasks.register<Jar >(" javadocJar" ) {
239+ archiveClassifier.set(" javadoc" )
240+ // For Kotlin projects, we can use an empty javadoc jar or generate KDoc
241+ // Empty javadoc is acceptable for Maven Central
242+ }
243+
244+ // Signing configuration
245+ signing {
246+ val signingKey = System .getenv(" GPG_PRIVATE_KEY" )
247+ val signingPassword = System .getenv(" GPG_PASSPHRASE" )
248+
249+ if (signingKey != null && signingPassword != null ) {
250+ useInMemoryPgpKeys(signingKey, signingPassword)
251+ sign(publishing.publications[" maven" ])
252+ }
253+ }
254+
255+ // JReleaser configuration
256+ jreleaser {
257+ project {
258+ description.set(" A lightweight, modular framework for building RESTful APIs with Kotlin and Vert.x" )
259+ authors.add(" StatuCorp" )
260+ license.set(" MIT" )
261+ links {
262+ homepage.set(" https://github.com/Statucorp/parsek-core" )
263+ }
264+ inceptionYear.set(" 2024" )
265+ }
266+
267+ // Disable release (semantic-release handles GitHub releases)
268+ release {
269+ github {
270+ enabled.set(false )
271+ }
272+ }
273+
274+ signing {
275+ active.set(org.jreleaser.model.Active .ALWAYS )
276+ armored.set(true )
277+ }
278+
279+ deploy {
280+ maven {
281+ mavenCentral {
282+ create(" sonatype" ) {
283+ active.set(org.jreleaser.model.Active .ALWAYS )
284+ url.set(" https://central.sonatype.com/api/v1/publisher" )
285+ stagingRepository(" build/staging-deploy" )
286+ }
287+ }
288+ }
289+ }
215290}
0 commit comments