Switch deployment to the central repository

This commit is contained in:
NotMyFault 2021-09-04 13:58:16 +02:00
parent f036980dc5
commit c18b0f943c
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C

View File

@ -6,6 +6,7 @@ plugins {
java java
`java-library` `java-library`
`maven-publish` `maven-publish`
signing
alias(libs.plugins.shadow) alias(libs.plugins.shadow)
alias(libs.plugins.licenser) alias(libs.plugins.licenser)
@ -21,7 +22,11 @@ val versionsuffix: String? by project
if (versionsuffix != null) { if (versionsuffix != null) {
versuffix = "-$versionsuffix" versuffix = "-$versionsuffix"
} }
version = ver + versuffix version = if (!project.hasProperty("release")) {
ver + versuffix
} else {
ver
}
allprojects { allprojects {
group = "com.plotsquared" group = "com.plotsquared"
@ -59,22 +64,11 @@ subprojects {
plugin<MavenPublishPlugin>() plugin<MavenPublishPlugin>()
plugin<ShadowPlugin>() plugin<ShadowPlugin>()
plugin<Licenser>() plugin<Licenser>()
plugin<SigningPlugin>()
plugin<EclipsePlugin>() plugin<EclipsePlugin>()
plugin<IdeaPlugin>() plugin<IdeaPlugin>()
} }
tasks {
// This is to create the target dir under the root project with all jars.
val assembleTargetDir = create<Copy>("assembleTargetDirectory") {
destinationDir = rootDir.resolve("target")
into(destinationDir)
from(withType<Jar>())
}
named("build") {
dependsOn(assembleTargetDir)
}
}
} }
val javadocDir = rootDir.resolve("docs").resolve("javadoc").resolve(project.name) val javadocDir = rootDir.resolve("docs").resolve("javadoc").resolve(project.name)
@ -88,7 +82,6 @@ allprojects {
plugins.withId("java") { plugins.withId("java") {
the<JavaPluginExtension>().toolchain { the<JavaPluginExtension>().toolchain {
languageVersion.set(JavaLanguageVersion.of(16)) languageVersion.set(JavaLanguageVersion.of(16))
vendor.set(JvmVendorSpec.ADOPTOPENJDK)
} }
} }
@ -103,6 +96,13 @@ allprojects {
withJavadocJar() withJavadocJar()
} }
signing {
if (!version.toString().endsWith("-SNAPSHOT")) {
signing.isRequired
sign(publishing.publications)
}
}
publishing { publishing {
publications { publications {
create<MavenPublication>("maven") { create<MavenPublication>("maven") {
@ -111,6 +111,11 @@ allprojects {
from(components["java"]) from(components["java"])
pom { pom {
name.set(project.name + " " + project.version)
description.set("PlotSquared is a land and world management plugin for Minecraft.")
url.set("https://github.com/IntellectualSites/PlotSquared")
licenses { licenses {
license { license {
name.set("GNU General Public License, Version 3.0") name.set("GNU General Public License, Version 3.0")
@ -143,6 +148,11 @@ allprojects {
connection.set("scm:https://IntellectualSites@github.com/IntellectualSites/PlotSquared.git") connection.set("scm:https://IntellectualSites@github.com/IntellectualSites/PlotSquared.git")
developerConnection.set("scm:git://github.com/IntellectualSites/PlotSquared.git") developerConnection.set("scm:git://github.com/IntellectualSites/PlotSquared.git")
} }
issueManagement{
system.set("GitHub")
url.set("https://github.com/IntellectualSites/PlotSquared/issues")
}
} }
} }
} }
@ -158,11 +168,11 @@ allprojects {
val nexusPassword: String? by project val nexusPassword: String? by project
if (nexusUsername != null && nexusPassword != null) { if (nexusUsername != null && nexusPassword != null) {
maven { maven {
val repositoryUrl = "https://mvn.intellectualsites.com/content/repositories/releases/" val releasesRepositoryUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
val snapshotRepositoryUrl = "https://mvn.intellectualsites.com/content/repositories/snapshots/" val snapshotRepositoryUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
url = uri( url = uri(
if (version.toString().endsWith("-SNAPSHOT")) snapshotRepositoryUrl if (version.toString().endsWith("-SNAPSHOT")) snapshotRepositoryUrl
else repositoryUrl else releasesRepositoryUrl
) )
credentials { credentials {
@ -179,7 +189,6 @@ allprojects {
tasks { tasks {
named<Delete>("clean") { named<Delete>("clean") {
doFirst { doFirst {
rootDir.resolve("target").deleteRecursively()
javadocDir.deleteRecursively() javadocDir.deleteRecursively()
} }
} }
@ -201,7 +210,6 @@ allprojects {
"implSpec:a:Implementation Requirements:", "implSpec:a:Implementation Requirements:",
"implNote:a:Implementation Note:" "implNote:a:Implementation Note:"
) )
opt.destinationDirectory = javadocDir
} }
jar { jar {