diff --git a/build.gradle b/build.gradle index d2ef10fc..d6686f72 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 de178119..bd1ca77b 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