Skip to content

Commit 49b5d84

Browse files
committed
chore: update publishing
1 parent ce968b0 commit 49b5d84

File tree

4 files changed

+115
-116
lines changed

4 files changed

+115
-116
lines changed

build.gradle.kts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import java.time.format.DateTimeFormatter
66
import xyz.jpenilla.runpaper.task.RunServer
77

88
plugins {
9-
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
109
id("xyz.jpenilla.run-paper") version "2.3.1"
1110
}
1211

@@ -103,12 +102,3 @@ tasks {
103102

104103
}
105104
}
106-
107-
nexusPublishing {
108-
this.repositories {
109-
sonatype {
110-
nexusUrl.set(URI.create("https://s01.oss.sonatype.org/service/local/"))
111-
snapshotRepositoryUrl.set(URI.create("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
112-
}
113-
}
114-
}

buildSrc/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ dependencies {
2424
implementation(gradleApi())
2525
implementation("org.ajoberstar.grgit:grgit-gradle:5.3.2")
2626
implementation("com.gradleup.shadow:shadow-gradle-plugin:8.3.8")
27+
implementation("com.vanniktech:gradle-maven-publish-plugin:0.34.0")
2728
implementation("io.papermc.paperweight.userdev:io.papermc.paperweight.userdev.gradle.plugin:2.0.0-SNAPSHOT")
2829
constraints {
2930
val asmVersion = "[9.7,)"

buildSrc/src/main/kotlin/LibsConfig.kt

Lines changed: 60 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
2+
import com.vanniktech.maven.publish.MavenPublishBaseExtension
23
import org.gradle.api.Plugin
34
import org.gradle.api.Project
45
import org.gradle.api.artifacts.ExternalModuleDependency
@@ -28,7 +29,7 @@ import javax.inject.Inject
2829
fun Project.applyLibrariesConfiguration() {
2930
applyCommonConfiguration()
3031
apply(plugin = "java-base")
31-
apply(plugin = "maven-publish")
32+
apply(plugin = "com.vanniktech.maven.publish")
3233
apply(plugin = "com.gradleup.shadow")
3334
apply(plugin = "signing")
3435

@@ -41,7 +42,6 @@ fun Project.applyLibrariesConfiguration() {
4142
val relocations = mapOf(
4243
"net.kyori.text" to "com.sk89q.worldedit.util.formatting.text",
4344
"net.kyori.minecraft" to "com.sk89q.worldedit.util.kyori"
44-
4545
)
4646

4747
tasks.register<ShadowJar>("jar") {
@@ -214,60 +214,72 @@ fun Project.applyLibrariesConfiguration() {
214214
}
215215
}
216216

217+
// the publish plugin does not allow custom platforms as of now and requires the java or java-library plugin to work with
218+
// the builtin platforms. tried a few things, but updating this file to support the new plugin results in quite a few errors.
219+
// -> configure the component for the publication ourselves, and delegate the rest to the extension of the plugin.
220+
// logs an error that "no compatible plugin [can be] found in <module> for publishing" - but at least it works (:
217221
configure<PublishingExtension> {
218222
publications {
219-
register<MavenPublication>("maven") {
223+
create("maven", MavenPublication::class.java) {
220224
from(libsComponent)
225+
}
226+
}
227+
}
221228

222-
group = "com.fastasyncworldedit"
223-
artifactId = "FastAsyncWorldEdit-Libs-${project.name.replaceFirstChar(Char::titlecase)}"
224-
version = version
225-
226-
pom {
227-
name.set("${rootProject.name}-Libs" + " " + project.version)
228-
description.set("Blazingly fast Minecraft world manipulation for artists, builders and everyone else.")
229-
url.set("https://github.com/IntellectualSites/FastAsyncWorldEdit")
230-
231-
licenses {
232-
license {
233-
name.set("GNU General Public License, Version 3.0")
234-
url.set("https://www.gnu.org/licenses/gpl-3.0.html")
235-
distribution.set("repo")
236-
}
237-
}
229+
configure<MavenPublishBaseExtension> {
230+
coordinates(
231+
groupId = "com.fastasyncworldedit",
232+
artifactId = "FastAsyncWorldEdit-Libs-${project.name.replaceFirstChar(Char::titlecase)}",
233+
version = "$version"
234+
)
235+
pom {
236+
name.set("${rootProject.name}-Libs" + " " + project.version)
237+
description.set("Blazingly fast Minecraft world manipulation for artists, builders and everyone else.")
238+
url.set("https://github.com/IntellectualSites/FastAsyncWorldEdit")
239+
240+
licenses {
241+
license {
242+
name.set("GNU General Public License, Version 3.0")
243+
url.set("https://www.gnu.org/licenses/gpl-3.0.html")
244+
distribution.set("repo")
245+
}
246+
}
238247

239-
developers {
240-
developer {
241-
id.set("NotMyFault")
242-
name.set("Alexander Brandes")
243-
email.set("contact(at)notmyfault.dev")
244-
organization.set("IntellectualSites")
245-
}
246-
developer {
247-
id.set("SirYwell")
248-
name.set("Hannes Greule")
249-
organization.set("IntellectualSites")
250-
}
251-
developer {
252-
id.set("dordsor21")
253-
name.set("dordsor21")
254-
organization.set("IntellectualSites")
255-
}
256-
}
248+
developers {
249+
developer {
250+
id.set("NotMyFault")
251+
name.set("Alexander Brandes")
252+
email.set("contact(at)notmyfault.dev")
253+
organization.set("IntellectualSites")
254+
organizationUrl.set("https://github.com/IntellectualSites")
255+
}
256+
developer {
257+
id.set("SirYwell")
258+
name.set("Hannes Greule")
259+
organization.set("IntellectualSites")
260+
organizationUrl.set("https://github.com/IntellectualSites")
261+
}
262+
developer {
263+
id.set("dordsor21")
264+
name.set("dordsor21")
265+
organization.set("IntellectualSites")
266+
organizationUrl.set("https://github.com/IntellectualSites")
267+
}
268+
}
257269

258-
scm {
259-
url.set("https://github.com/IntellectualSites/FastAsyncWorldEdit")
260-
connection.set("scm:git:https://github.com/IntellectualSites/FastAsyncWorldEdit.git")
261-
developerConnection.set("scm:git:git@github.com:IntellectualSites/FastAsyncWorldEdit.git")
262-
tag.set("${project.version}")
263-
}
270+
scm {
271+
url.set("https://github.com/IntellectualSites/FastAsyncWorldEdit")
272+
connection.set("scm:git:https://github.com/IntellectualSites/FastAsyncWorldEdit.git")
273+
developerConnection.set("scm:git:git@github.com:IntellectualSites/FastAsyncWorldEdit.git")
274+
tag.set("${project.version}")
275+
}
264276

265-
issueManagement {
266-
system.set("GitHub")
267-
url.set("https://github.com/IntellectualSites/FastAsyncWorldEdit/issues")
268-
}
269-
}
277+
issueManagement {
278+
system.set("GitHub")
279+
url.set("https://github.com/IntellectualSites/FastAsyncWorldEdit/issues")
270280
}
281+
282+
publishToMavenCentral()
271283
}
272284
}
273285

buildSrc/src/main/kotlin/PlatformConfig.kt

Lines changed: 54 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
2+
import com.vanniktech.maven.publish.MavenPublishBaseExtension
23
import org.gradle.api.Project
34
import org.gradle.api.component.AdhocComponentWithVariants
45
import org.gradle.api.plugins.JavaPluginExtension
56
import org.gradle.api.publish.PublishingExtension
6-
import org.gradle.api.publish.maven.MavenPublication
77
import org.gradle.api.tasks.bundling.Jar
88
import org.gradle.kotlin.dsl.apply
99
import org.gradle.kotlin.dsl.configure
1010
import org.gradle.kotlin.dsl.get
1111
import org.gradle.kotlin.dsl.named
1212
import org.gradle.kotlin.dsl.provideDelegate
13-
import org.gradle.kotlin.dsl.register
1413
import org.gradle.kotlin.dsl.the
1514
import org.gradle.kotlin.dsl.withType
1615
import org.gradle.plugins.signing.SigningExtension
@@ -20,7 +19,7 @@ fun Project.applyPlatformAndCoreConfiguration() {
2019
apply(plugin = "java")
2120
apply(plugin = "eclipse")
2221
apply(plugin = "idea")
23-
apply(plugin = "maven-publish")
22+
apply(plugin = "com.vanniktech.maven.publish")
2423
apply(plugin = "com.gradleup.shadow")
2524
apply(plugin = "signing")
2625

@@ -60,63 +59,60 @@ fun Project.applyPlatformAndCoreConfiguration() {
6059
}
6160
}
6261

63-
configure<PublishingExtension> {
64-
publications {
65-
register<MavenPublication>("maven") {
66-
from(javaComponent)
67-
68-
group = "com.fastasyncworldedit"
69-
artifactId = "${rootProject.name}-${project.description}"
70-
version = version
71-
72-
pom {
73-
name.set("${rootProject.name}-${project.description}" + " " + project.version)
74-
description.set("Blazingly fast Minecraft world manipulation for artists, builders and everyone else.")
75-
url.set("https://github.com/IntellectualSites/FastAsyncWorldEdit")
76-
77-
licenses {
78-
license {
79-
name.set("GNU General Public License, Version 3.0")
80-
url.set("https://www.gnu.org/licenses/gpl-3.0.html")
81-
distribution.set("repo")
82-
}
83-
}
84-
85-
developers {
86-
developer {
87-
id.set("NotMyFault")
88-
name.set("Alexander Brandes")
89-
email.set("contact(at)notmyfault.dev")
90-
organization.set("IntellectualSites")
91-
organizationUrl.set("https://github.com/IntellectualSites")
92-
}
93-
developer {
94-
id.set("SirYwell")
95-
name.set("Hannes Greule")
96-
organization.set("IntellectualSites")
97-
organizationUrl.set("https://github.com/IntellectualSites")
98-
}
99-
developer {
100-
id.set("dordsor21")
101-
name.set("dordsor21")
102-
organization.set("IntellectualSites")
103-
organizationUrl.set("https://github.com/IntellectualSites")
104-
}
105-
}
106-
107-
scm {
108-
url.set("https://github.com/IntellectualSites/FastAsyncWorldEdit")
109-
connection.set("scm:git:https://github.com/IntellectualSites/FastAsyncWorldEdit.git")
110-
developerConnection.set("scm:git:git@github.com:IntellectualSites/FastAsyncWorldEdit.git")
111-
tag.set("${project.version}")
112-
}
113-
114-
issueManagement{
115-
system.set("GitHub")
116-
url.set("https://github.com/IntellectualSites/FastAsyncWorldEdit/issues")
117-
}
62+
configure<MavenPublishBaseExtension> {
63+
coordinates(
64+
groupId = "com.fastasyncworldedit",
65+
artifactId = "${rootProject.name}-${project.description}",
66+
version = "$version"
67+
)
68+
pom {
69+
name.set("${rootProject.name}-${project.description}" + " " + project.version)
70+
description.set("Blazingly fast Minecraft world manipulation for artists, builders and everyone else.")
71+
url.set("https://github.com/IntellectualSites/FastAsyncWorldEdit")
72+
73+
licenses {
74+
license {
75+
name.set("GNU General Public License, Version 3.0")
76+
url.set("https://www.gnu.org/licenses/gpl-3.0.html")
77+
distribution.set("repo")
78+
}
79+
}
80+
81+
developers {
82+
developer {
83+
id.set("NotMyFault")
84+
name.set("Alexander Brandes")
85+
email.set("contact(at)notmyfault.dev")
86+
organization.set("IntellectualSites")
87+
organizationUrl.set("https://github.com/IntellectualSites")
88+
}
89+
developer {
90+
id.set("SirYwell")
91+
name.set("Hannes Greule")
92+
organization.set("IntellectualSites")
93+
organizationUrl.set("https://github.com/IntellectualSites")
94+
}
95+
developer {
96+
id.set("dordsor21")
97+
name.set("dordsor21")
98+
organization.set("IntellectualSites")
99+
organizationUrl.set("https://github.com/IntellectualSites")
118100
}
119101
}
102+
103+
scm {
104+
url.set("https://github.com/IntellectualSites/FastAsyncWorldEdit")
105+
connection.set("scm:git:https://github.com/IntellectualSites/FastAsyncWorldEdit.git")
106+
developerConnection.set("scm:git:git@github.com:IntellectualSites/FastAsyncWorldEdit.git")
107+
tag.set("${project.version}")
108+
}
109+
110+
issueManagement {
111+
system.set("GitHub")
112+
url.set("https://github.com/IntellectualSites/FastAsyncWorldEdit/issues")
113+
}
114+
115+
publishToMavenCentral()
120116
}
121117
}
122118

0 commit comments

Comments
 (0)