From dec6086ef801d3f08b9bcbe72227e1ef9c1690dd Mon Sep 17 00:00:00 2001 From: Sheikah45 Date: Sat, 23 Nov 2024 18:18:05 -0500 Subject: [PATCH] Use other plugin --- api/build.gradle.kts | 55 ++++++++++++++++++++++++++++++++++++++++++++ build.gradle.kts | 50 ---------------------------------------- 2 files changed, 55 insertions(+), 50 deletions(-) diff --git a/api/build.gradle.kts b/api/build.gradle.kts index e2764017..e6a80127 100644 --- a/api/build.gradle.kts +++ b/api/build.gradle.kts @@ -1,3 +1,7 @@ +plugins { + id("eu.kakde.gradle.sonatype-maven-central-publisher") version "1.0.6" +} + java { sourceCompatibility = JavaVersion.VERSION_21 targetCompatibility = JavaVersion.VERSION_21 @@ -21,3 +25,54 @@ dependencies { testImplementation(libs.pojo.tester) testCompileOnly(libs.jetbrains.annotations) } + +signing { + publishing.publications.configureEach { + sign(this) + } + sign(configurations.archives.get()) +} + +sonatypeCentralPublishExtension { + // Set group ID, artifact ID, version, and other publication details + groupId.set("com.faforever") + artifactId.set("api") + version.set("unspecified") + componentType.set("java") // "java" or "versionCatalog" + publishingType.set("USER_MANAGED") // USER_MANAGED or AUTOMATIC + shaAlgorithms.set(listOf("SHA-256", "SHA-512" )) + + // Set username and password for Sonatype repository + username.set(project.properties["sonatypeUsername"].toString()) + password.set(project.properties["sonatypePassword"].toString()) + + // Configure POM metadata + pom { + name.set("api") + description.set("API DTOs for FAForever Java API") + url.set("https://github.com/FAForever/faf-java-commons") + licenses { + license { + name.set("MIT") + url.set("https://www.opensource.org/licenses/mit-license.php") + } + } + developers { + developer { + id.set("Brutus5000") + name.set("Brutus5000") + organization.set("FAForever") + organizationUrl.set("https://github.com/FAForever") + } + } + scm { + url.set("https://github.com/FAForever/faf-java-commons") + connection.set("scm:git:https://github.com/FAForever/faf-java-commons") + developerConnection.set("scm:git:https://github.com/FAForever/faf-java-commons") + } + issueManagement { + system.set("GitHub") + url.set("https://github.com/FAForever/faf-java-commons/issues") + } + } +} diff --git a/build.gradle.kts b/build.gradle.kts index 71d46e49..383918dc 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -16,55 +16,5 @@ configure(subprojects) { tasks.withType { useJUnitPlatform() - } - - configure { - publications { - create("maven") { - from(components["java"]) - pom { - name.set(project.properties["project_display_name"].toString()) - description.set(project.properties["project_description"].toString()) - url.set(project.properties["project_website"].toString()) - issueManagement { - system.set("GitHub") - url.set(project.properties["project_issues"].toString()) - } - scm { - url.set(project.properties["project_website"].toString()) - connection.set("scm:git:${project.properties["project_vcs"].toString()}") - developerConnection.set("scm:git:${project.properties["project_vcs_git"].toString()}") - } - licenses { - license { - name.set("The MIT License (MIT)") - url.set("http://www.opensource.org/licenses/mit-license.php") - distribution.set("repo") - } - } - developers { - developer { - id.set("Brutus5000") - name.set("Brutus5000") - organization { - name.set("FAForever") - url.set("https://github.com/FAForever") - } - } - } - } - } - } - - repositories { - maven { - name = "MavenCentral" - url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") - credentials { - username = project.properties["sonatypeUsername"].toString() - password = project.properties["sonatypePassword"].toString() - } - } - } } }