Maven publish fixes

This commit is contained in:
crschnick 2024-07-17 09:24:42 +00:00
parent adf98c5a8c
commit f3f63aa0f7
2 changed files with 24 additions and 33 deletions

View file

@ -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

View file

@ -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
}