Skip to content

Commit ef087cd

Browse files
ref: fix publishing method in build.gradle.kts
1 parent 888efe9 commit ef087cd

File tree

1 file changed

+23
-49
lines changed

1 file changed

+23
-49
lines changed

build.gradle.kts

Lines changed: 23 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import org.gradle.kotlin.dsl.from
12
import org.gradle.kotlin.dsl.invoke
23

34
plugins {
@@ -26,6 +27,7 @@ allprojects {
2627

2728
subprojects {
2829
apply(plugin = "org.jetbrains.kotlin.jvm")
30+
apply(plugin = "net.thebugmc.gradle.sonatype-central-portal-publisher")
2931

3032
dependencies {
3133
compileOnly(rootProject.libs.kotlinJvm)
@@ -36,63 +38,35 @@ subprojects {
3638
kotlin {
3739
jvmToolchain(21)
3840
}
39-
}
4041

41-
publishing {
42-
repositories {
43-
maven {
44-
name = "simplecloud"
45-
url = uri("https://repo.simplecloud.app/snapshots/")
46-
credentials {
47-
username = System.getenv("SIMPLECLOUD_USERNAME")?: (project.findProperty("simplecloudUsername") as? String)
48-
password = System.getenv("SIMPLECLOUD_PASSWORD")?: (project.findProperty("simplecloudPassword") as? String)
49-
}
50-
authentication {
51-
create<BasicAuthentication>("basic")
42+
publishing {
43+
repositories {
44+
maven {
45+
name = "simplecloud"
46+
url = uri("https://repo.simplecloud.app/snapshots/")
47+
credentials {
48+
username = System.getenv("SIMPLECLOUD_USERNAME")?: (project.findProperty("simplecloudUsername") as? String)
49+
password = System.getenv("SIMPLECLOUD_PASSWORD")?: (project.findProperty("simplecloudPassword") as? String)
50+
}
51+
authentication {
52+
create<BasicAuthentication>("basic")
53+
}
5254
}
5355
}
54-
}
5556

56-
publications {
57-
create<MavenPublication>("mavenJava") {
58-
from(components["java"])
57+
publications {
58+
create<MavenPublication>("mavenJava") {
59+
from(components["java"])
60+
}
5961
}
6062
}
61-
}
62-
63-
centralPortal {
64-
name = project.name
65-
66-
username = project.findProperty("sonatypeUsername") as? String
67-
password = project.findProperty("sonatypePassword") as? String
6863

69-
pom {
70-
name.set("SimpleCloud Plugin API")
71-
description.set("Commonly used classes among plugins")
72-
url.set("https://github.com/theSimpleCloud/plugin-api")
73-
developers {
74-
developer {
75-
id.set("MrManHD")
76-
}
77-
}
78-
licenses {
79-
license {
80-
name.set("Apache-2.0")
81-
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
82-
}
83-
}
84-
scm {
85-
url.set("https://github.com/theSimpleCloud/plugin-api.git")
86-
connection.set("git:[email protected]:theSimpleCloud/plugin-api.git")
64+
signing {
65+
if (commitHash != null) {
66+
return@signing
8767
}
88-
}
89-
}
9068

91-
signing {
92-
if (commitHash != null) {
93-
return@signing
69+
sign(publishing.publications)
70+
useGpgCmd()
9471
}
95-
96-
sign(publishing.publications)
97-
useGpgCmd()
9872
}

0 commit comments

Comments
 (0)