@@ -2,14 +2,15 @@ import net.minecrell.pluginyml.bukkit.BukkitPluginDescription
22
33plugins {
44 java
5+ `java- library`
56 idea
67 id(" com.gradleup.shadow" ) version " 8.3.2"
78 id(" net.minecrell.plugin-yml.bukkit" ) version " 0.6.0"
89 id(" xyz.jpenilla.run-paper" ) version " 2.3.0"
910 id(" io.freefair.lombok" ) version " 8.13.1"
1011 `maven- publish`
1112 signing
12- id(" net.thebugmc.gradle.sonatype-central-portal-publisher " ) version " 1.2.4 "
13+ id(" com.gradleup.nmcp.aggregation " ) version " 1.1.0 "
1314}
1415
1516group = " io.github.pylonmc"
3839
3940java {
4041 toolchain.languageVersion = JavaLanguageVersion .of(21 )
42+ withSourcesJar()
43+ withJavadocJar()
4144}
4245
4346tasks.shadowJar {
@@ -68,44 +71,68 @@ tasks.runServer {
6871 minecraftVersion(" 1.21.8" )
6972}
7073
71- // Disable signing for maven local publish
72- if (project.gradle.startParameter.taskNames.any { it.contains(" publishToMavenLocal" ) }) {
73- tasks.withType<Sign >().configureEach {
74- enabled = false
75- }
76- }
77-
7874tasks.withType<Jar > {
7975 duplicatesStrategy = DuplicatesStrategy .INCLUDE
8076}
8177
78+ publishing {
79+ publications {
80+ create<MavenPublication >(" maven" ) {
81+ artifactId = project.name
82+
83+ from(components[" java" ])
84+
85+ pom {
86+ name = project.name
87+ description = " The base addon for Pylon."
88+ url = " https://github.com/pylonmc/pylon-base"
89+ licenses {
90+ license {
91+ name = " GNU Lesser General Public License Version 3"
92+ url = " https://www.gnu.org/licenses/lgpl-3.0.txt"
93+ }
94+ }
95+ developers {
96+ developer {
97+ id = " PylonMC"
98+ name = " PylonMC"
99+ organizationUrl = " https://github.com/pylonmc"
100+ }
101+ }
102+ scm {
103+ connection = " scm:git:git://github.com/pylonmc/pylon-base.git"
104+ developerConnection = " scm:git:ssh://github.com:pylonmc/pylon-base.git"
105+ url = " https://github.com/pylonmc/pylon-base"
106+ }
107+ // Bypass maven-publish erroring when using `from(components["java"])`
108+ withXml {
109+ val root = asNode()
110+ val dependenciesNode = root.appendNode(" dependencies" )
111+ val configs = listOf (configurations.compileOnlyApi, configurations.api)
112+ configs.flatMap { it.get().dependencies }.forEach {
113+ val dependencyNode = dependenciesNode.appendNode(" dependency" )
114+ dependencyNode.appendNode(" groupId" , it.group)
115+ dependencyNode.appendNode(" artifactId" , it.name)
116+ dependencyNode.appendNode(" version" , it.version)
117+ dependencyNode.appendNode(" scope" , " compile" )
118+ }
119+ }
120+ }
121+ }
122+ }
123+ }
124+
82125signing {
83126 useInMemoryPgpKeys(System .getenv(" SIGNING_KEY" ), System .getenv(" SIGNING_PASSWORD" ))
127+
128+ sign(publishing.publications[" maven" ])
84129}
85130
86- centralPortal {
87- username = System .getenv(" SONATYPE_USERNAME" )
88- password = System .getenv(" SONATYPE_PASSWORD" )
89- pom {
90- description = " The base addon for Pylon."
91- url = " https://github.com/pylonmc/pylon-base"
92- licenses {
93- license {
94- name = " GNU Lesser General Public License Version 3"
95- url = " https://www.gnu.org/licenses/lgpl-3.0.txt"
96- }
97- }
98- developers {
99- developer {
100- id = " PylonMC"
101- name = " PylonMC"
102- organizationUrl = " https://github.com/pylonmc"
103- }
104- }
105- scm {
106- connection = " scm:git:git://github.com/pylonmc/pylon-base.git"
107- developerConnection = " scm:git:ssh://github.com:pylonmc/pylon-base.git"
108- url = " https://github.com/pylonmc/pylon-base"
109- }
131+ nmcpAggregation {
132+ centralPortal {
133+ username = System .getenv(" SONATYPE_USERNAME" )
134+ password = System .getenv(" SONATYPE_PASSWORD" )
135+ publishingType = " AUTOMATIC"
110136 }
137+ publishAllProjectsProbablyBreakingProjectIsolation()
111138}
0 commit comments