From f3f63aa0f7eead8b81eb7f83e5d1d1956d053cec Mon Sep 17 00:00:00 2001 From: crschnick Date: Wed, 17 Jul 2024 09:24:42 +0000 Subject: [PATCH] Maven publish fixes --- build.gradle | 25 +++++++++++++++++- gradle/gradle_scripts/publish-base.gradle | 32 ----------------------- 2 files changed, 24 insertions(+), 33 deletions(-) diff --git a/build.gradle b/build.gradle index d2ef10fc7..d6686f729 100644 --- a/build.gradle +++ b/build.gradle @@ -12,7 +12,7 @@ buildscript { } plugins { - id "io.codearte.nexus-staging" version "0.30.0" + id("io.github.gradle-nexus.publish-plugin") version "2.0.0" id 'org.gradlex.extra-java-module-info' version '1.8' apply false id("com.diffplug.spotless") version "6.25.0" apply false } @@ -41,6 +41,26 @@ subprojects {subproject -> } } + +def user = project.hasProperty('sonatypeUsername') ? project.property('sonatypeUsername') : System.getenv('SONATYPE_USERNAME') +def pass = project.hasProperty('sonatypePassword') ? project.property('sonatypePassword') : System.getenv('SONATYPE_PASSWORD') + +tasks.withType(GenerateModuleMetadata) { + enabled = false +} + +nexusPublishing { + repositories { + sonatype { + nexusUrl.set(uri('https://s01.oss.sonatype.org/service/local/')) + snapshotRepositoryUrl.set(uri('https://s01.oss.sonatype.org/content/repositories/snapshots/')) + username = user + password = pass + } + } + useStaging = true +} + var devProps = file("$rootDir/app/dev.properties") if (!devProps.exists()) { devProps.text = file("$rootDir/gradle/gradle_scripts/dev_default.properties").text @@ -212,3 +232,6 @@ task testAll(type: DefaultTask) { } finalizedBy(testReport) } + +group = 'io.xpipe' +version = versionString \ No newline at end of file diff --git a/gradle/gradle_scripts/publish-base.gradle b/gradle/gradle_scripts/publish-base.gradle index de1781192..bd1ca77b8 100644 --- a/gradle/gradle_scripts/publish-base.gradle +++ b/gradle/gradle_scripts/publish-base.gradle @@ -3,39 +3,7 @@ java { withSourcesJar() } -def repoUrl = !rootProject.isFullRelease ? 'https://s01.oss.sonatype.org/content/repositories/snapshots/' - : 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/' -def user = project.hasProperty('sonatypeUsername') ? project.property('sonatypeUsername') : System.getenv('SONATYPE_USERNAME') -def pass = project.hasProperty('sonatypePassword') ? project.property('sonatypePassword') : System.getenv('SONATYPE_PASSWORD') - -if (rootProject.isFullRelease) { - publish.finalizedBy(rootProject.getTasks().getByName('closeAndReleaseRepository')) -} - -tasks.withType(GenerateModuleMetadata) { - enabled = false -} - -publishing { - repositories { - maven { - setUrl repoUrl - credentials { - setUsername user - setPassword pass - } - } - } -} - signing { useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword) sign publishing.publications.mavenJava } - -nexusStaging { - serverUrl = "https://s01.oss.sonatype.org/service/local/" - packageGroup = "io.xpipe" - username = user - password = pass -} \ No newline at end of file